newbie here, first post.
I just spent like 4 hours trying to assign one category to a post (trying out a regular blog thing) via radio buttons, to no avail. The association is working fine, and ultimately I managed to get it working with a select menu, but for some reason it seems radio buttons are simply not meant for that.
I really don’t like using a select menu for that because I only have 4 categories and having to click twice to select a single one is 1 click too many. So I would really like to use radio buttons instead.
I checked out the other question on the subject and searched the web senseless but it only helped me get a more diverse array of errors: Undefined methods, AssociationTypeMismatch, category_ids of 0, you name it. So I gave up for today and decided to create a account and see if anyone can crack this one. Any help will be appreciated.
Thanks.
Here we go. In RailsCasts Episode 17 Ryan uses habtm and checkboxes to do this kind of thing. I modified it to use belongs_to and radio buttons. Thanks for the exercise.
Post Model
Post Create View (removed the default textbox for category_id)