title: Rails asking for a secret key to create model
body: <p>I am creating a simple blog / news website without a user authentication system. I've decided to a use plain some sort of secret key checking technique to allow visitors who know the key to make posts.</p>
  
  <p>In short, to post, you have to provide a key. Otherwise, it object should not be saved into the db.</p>
  
  <p>Here's my code.</p>
  
  <pre><code>class Post &lt; ActiveRecord::Base
  
    attr_accessor :slaptazodis
  
    validate :passcheck
    validates :title, presence: true
    validates :body, presence: true
  
    def passcheck
  
      if :slaptazodis != "1234"
        errors.add(:base, 'Invalid pass')
      end
    end
  end
  </code></pre>
  
  <p>So, I create a new model in sandbox with title, body and attribute slaptazodis set to 1234. Still, when I check errors, console keeps showing me "Invalid pass". What am I doing wrong? Is it about attributes or something? Thank you in advance :)</p>