Skip to content

wrong argument type String (expected Module) Ruby on Rails error

Posted on 09 June 2006

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.

View the snippets archive ››

5 comments made

Alain Pilon commented on 01 Jun 07 at 22:58

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?

Rob Dupuis commented on 11 Sep 07 at 04:26

Good man. Thanks you. I keep getting bitten by this stuff.

Nico Du Plessis commented on 17 Feb 08 at 11:30

Just saved me some time too :) thanks

Antony commented on 17 Apr 08 at 18:05

Gosh, spent several hours trying to fix this one. Wish I had found this site quicker!!

Roland commented on 03 Oct 08 at 08:47

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?

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