lundi 9 mars 2015

Argument Error: The scope body needs to be callable

I'm working through the 'Ruby On Rails 3 Essential Training' and have received a problem when using name scopes. When finding records and using queries withing the Rails console everything went smoothly until I tried to use a name scope in my subject.rb file. This is my code in the subject.rb file.



Class Subject < ActiveRecord::Base

scope :visible, where(:visible => true)

end


I saved the .rb file and restarted my Rails console but when I run from my rails console:



subjects = Subject.visible


I get: ArgumentError: The scope body needs to be callable.


Does anyone know why I'm getting this error. Thank you!


Aucun commentaire:

Enregistrer un commentaire