I have a form which has a variety of fields and field types. Each
field is presenting a unique challenge in understanding how the active
option is selected by default from data in the corresponding model.
In one instance, I have two radio buttons, "on" and "off." In the
controller, I load up the boolean value for the user's settings from
the model user > notifications.
In the view I have the following:
<%= radio_button :user, :notifications, 1, :onclick =>
"Field.enable('time'), Field.enable('period')" %> on
<%= radio_button :user, :notifications, 0, :onclick =>
"Field.disable('time'), Field.disable('period')" %> off
I've added :checked => checked to get a default option (so I know that
works), but what I want is for the checked option to correspond to the
state in the model :user, :notifications. How do i do this???
These form helpers I'm finding confusing for this. Thanks for the