Wednesday 15 January 2014

ruby - Factory Girl and Rails with Cucumber gives undefined method error -


I have a model that looks like this

  class course & lt; ActiveRecord :: Base attr_accessible: name end   

and my factories. RB looks like this

  factorygear.define factory do: course "name" testname "end end   

Then when I call the factual This is how: given in the database / database database $ / do

I have an undefined method error Receives:

  Undefined method # name = 'for course ID: zero, created_at: zero, updated_at: zero > When I use attr_accessor instead of attr_accessible in the model, but in other instances, I should work with both of them. Is this a bug or is it? Am I doing something wrong?  

Links to examples where they say that it should work:

< P>

Either the field in question should be present in your database. The attribute specified in attr_accessible Do not make the ActiveRecord Aksesrs (depending on Faktrigiyr), but only if they are defined in the relevant database table.

No comments:

Post a Comment