You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cuzican@CUZIVISTA ~/gitrepo/test
$ vi app/models/office.rb
i then added the has_many association.. then i got the below
cuzican@CUZIVISTA ~/gitrepo/test
$ script/generate scaffold_for_view employee name:string --view belongs_to_auto_complete:office
error Class 'office' does not exist or contains a syntax error and could not be loaded.
I tried changing office to Office and then spent all kinds of time trying different variations of the has_many.. plural.. not.. looking at my rails env.. etc.. and I wasted a bit of time because I was too stupid to notice that I was adding the has_many as follows:
has_many employees
when i should have added it as "has_many :employees" .. damn colon..
added that colon and all was well.. since you do such a good job checking for things I figured I should let u know this one so you could add a check in it and save others headaches.. or not.. ;->
p.s. nice work.
The text was updated successfully, but these errors were encountered:
Thanks for trying view mapper! Hmm this is a tough one; I can see how helpful it would be to display Ruby syntax errors but I'm not sure how to do that right now. I'll do some reasearch and see if I can find a way. Right now view mapper displays that message if the class doesn't exist... which could be if you never wrote it or if Ruby returned an error trying to load it.
http://patshaughnessy.net/2010/2/13/creating-associations-to-existing-data-part-2-belongs_to-with-auto_complete
.
.
once I got to here..
cuzican@CUZIVISTA ~/gitrepo/test
$ script/generate scaffold_for_view employee name:string --view belongs_to_auto_complete:office
warning Model Office does not contain a has_many association for Employee.
cuzican@CUZIVISTA ~/gitrepo/test
$ vi app/models/office.rb
cuzican@CUZIVISTA ~/gitrepo/test
$ script/generate scaffold_for_view employee name:string --view belongs_to_auto_complete:office
error Class 'office' does not exist or contains a syntax error and could not be loaded.
I tried changing office to Office and then spent all kinds of time trying different variations of the has_many.. plural.. not.. looking at my rails env.. etc.. and I wasted a bit of time because I was too stupid to notice that I was adding the has_many as follows:
has_many employees
when i should have added it as "has_many :employees" .. damn colon..
added that colon and all was well.. since you do such a good job checking for things I figured I should let u know this one so you could add a check in it and save others headaches.. or not.. ;->
p.s. nice work.
The text was updated successfully, but these errors were encountered: