Closed 34code closed 9 years ago
Remove the User.
in your code, otherwise, you are making a class method, not an instance method.
and also, if you declare the field as :type => Boolean
, this method will be automatically provided.
If I remove User.
, my controller throws an error:
undefined method
activated?' for #
btw thanks for the super fast reply :)
ohh so you are looking to make a named scope then.
class User
scope(:activated) { where(:activated => true) }
end
Or alternatively:
class User
def self.activated
where(:activated => true)
end
end
You're welcome :)
Not sure about this scope thing. That particular line gives me a syntax error in User.rb..
Everything was working great earlier and find_by
was not deprecated and has_secure_password
was working out of the box..
Now the new version released and it seems some things have broken. I would love to help more by debugging if I can. Is that scope line supposed to go in controller and not model as I assumed perhaps?
Install http://tmate.io/ and share your terminal with me (send me the connection link via email) so I can help
excellent! thanks :)
gemfile
rethinkdb (>= 2.0.0.0)
nobrainer (0.25.1)
I have a field called activated in User.rb model.
field :activated
and the following code:
Yet I get the following error:
undefined method
activated' for User:Class`