Topic: Missing methods when using :conditions?
Hi, I hope this is the right place to ask this type of 'beginner' question. I'm following a tutorial on Rails and it was introducing the :conditions and :readonly parameters. The code example is pulling data from Company based on conditions, setting it to readonly, and assigning the value to 'c':
c = Company.find :first, :conditions => ['state = ?', 'KS'], :readonly => true
c.name = 'Something'
The example is to show that once it is set as readonly, you should not be able to save changes. However, I am not able to even call the name method. When I try the above example, I get:
NoMethodError: undefined method `name' for #<Array:0x1035eb3f8>
I can test the readonly parameter if I do something like:
c = Company.find :first, :readonly => true
So it seems to be related to applying the condition parameter. Can anyone explain to me what is going on? If I look at the c variable, it did find the record and stuff it in the variable so I know the data is there, but I cannot call any of the methods on it. Is there new changes to rails possibly that changed?
Last edited by derekmw (2010-11-02 12:41:37)