wrong argument type String (expected Module) Ruby on Rails error
I got the error wrong argument type String (expected Module) because I was trying to create a select drop down for a field called 'Type'. However, 'Type' is a reserved word and such gains certain behaviours.
The full list of these magic field names reveals as much.
My fix was to simply rename the column. However, that might not always be possible. I found this discussion on the Ruby forums interesting for some alternative suggestions.
About
Paul is a web developer for Kyanmedia web agency. He's lucky enough to write in Ruby on Rails full-time and uses this site to post snippets of code.
Contact
my name at gmail.com
More snippets
Take a look in the archive
Need a website?
Contact my employer. Make sure to check out our portfolio of work.
Hosting
I recommend hostingrails.com
5 comments made
Hehe, I was so happy to find the link to this as the first link on google! It could have been a real waste of time! I knew it was reserved but what else to do when you are using single table inheritence?
Good man. Thanks you. I keep getting bitten by this stuff.
Just saved me some time too :) thanks
Gosh, spent several hours trying to fix this one. Wish I had found this site quicker!!
God, I spent one hour on that problem…thanks for having writted this little note….even if I wish I found it sooner…
Got something to say?