So. The issue:
I couldn't get the radio_button or check_box tags to work with rails. They kept telling me:
wrong number of arguments (0 for 1)
Which didn't make any sense since I was supplying arguments correctly. I eventually tried making a radio_button in a different view and it worked fine. I found out that it was rails calling the Group model and probably communicating with ActiveRecord to the database that was causing me problems. So I backed up my application and started playing around with it.
What I was trying to do was get that column (the name of the column is "open" and it's in a table called "groups") to act like a boolean value to determine whether or not the group was a public or private group. Rails is supposed to allow it to act like that and I'm pretty sure scaffolds are even formed with a True/False select field thingie because I had done it before... so I set off to make that scaffold and try to get it to do that so I could just copy the code since clearly radio_button wasn't working.
So I created the scaffold.. tried to anyway:
>ruby script\generate scaffold Group
Didn't work.. so I tried variations: "scaffold group groups" "scaffold group" etc etc.. nothing worked. Commandline kept giving me "wrong number of arguments (0 for 1)" errors as well. Eventually I became distraught and tried to get RadRails to help me via its GUI for generators. Luckily the terminal gave me some more specific output:
Before updating scaffolding from new DB schema, try creating a table for your model (Group)
But my table was created. So I tried doing it in a different database.. same result.. then I tried doing it with a different table.. seemed to work.. so then I determined of course that something was wrong with my beautiful table.
I had recently added a column to it called "open". I decided to play around with that one. I changed the length from "1" to "3" just to see if it was the auto boolean thing rails does screwing up. Yep.. made it work. But I needed it to be bool. So I tried changing the column name. Yep. That worked too.
I let #rubyonrails on freenode know and at that same time CapnDeviance was reading something about reserved words. Yes.. that's "open" you see in that ticket.
So A_Bloke decided to update the reserved words page on the rubyonrails wiki and I thought I would write this up just so people searching for these errors online might find a solution to their problem.
Anyway.. my page works now and now I can use radio_button, check_box or whatever the hell else I want and it acts as boolean. Woohoo




March 30th, 2006 at 12:27
"I thought I would write this up just so people searching for these errors online might find a solution to their problem."
Yes I did, thank you!
April 11th, 2006 at 20:33
Man, you just saved me a lifetime of terrible frustration. I was using 'display' as a boolean field and trying to use the check_box. Same issue. Renaming it solved it right away. Thanks a million!
June 27th, 2006 at 12:05
I've been pulling my hair out for 2 days. Thanks for the info. I had a column called notify which was causing all sorts of issues and throwing obsure error messages.
October 21st, 2006 at 01:37
You saved me a lot of time! Excellent work, thank you.