Setting Rails Checkbox from Another Model

Posted by Kevin on Stack Overflow See other posts from Stack Overflow or by Kevin
Published on 2010-04-06T03:19:59Z Indexed on 2010/04/06 3:23 UTC
Read the original article Hit count: 229

Filed under:
|

I have a checkbox that belongs to "Foo" class. I have another "Preferences" class that sets the default for what that checkbox should be.

I tried using

f.check_box :email_preference, :value => preferences.email_preference

but it doesn't work. I use this page to do new record creation as well as edit, so obviously for new records I would want to take the preferences.email_preference setting as a default, then for editing the record use the foo.email_preference. Any suggestions?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about forms