Following the Lynda.com RoR video tutorials, you're taught how to make code for checkboxes. It's a bit of a hassle because there's a lot of cutting and pasting per checkbox collection you want to have. With the following code, you just paste several times to get things working.
I couldn't find a way to display this properly in blogger, so I posted that code in pastie.
Helper: http://pastie.caboo.se/104016
Code you will put in the model that will "contain the check list". For example, if a user has_and_belongs_to_many :roles, this code will be pasted on the User model.
http://pastie.caboo.se/100607
Then, when you want to generate the checklist, simply paste this in your view:
http://pastie.caboo.se/100609
When updating or saving, make sure you tell the user (or the model that has the checklist) to update! I used mine the following way in the controller:
http://pastie.caboo.se/100608
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment