CheckBox and Ruby on Rails

I have two questions:

  1. I have a checkbox on a form and after submit I need to check the
    status of the checkbox. Any idea how to see what the checkbox is set
    to? I am assuming this must be done in the controller or model but
    cannot figure it out.

  2. On load I am checking for a cookie and need to determine if the
    checkbox should be checked or unchecked. Is there a way for me to do
    this from the controller and actually set the checkbox to checked or
    unchecked.

David wrote:

I have two questions:

  1. I have a checkbox on a form and after submit I need to check the
    status of the checkbox. Any idea how to see what the checkbox is set
    to? I am assuming this must be done in the controller or model but
    cannot figure it out.

The value of the checkbox will be available in the params hash, just
like all the other form fields.

  1. On load I am checking for a cookie and need to determine if the
    checkbox should be checked or unchecked. Is there a way for me to do
    this from the controller and actually set the checkbox to checked or
    unchecked.

If you’re using form_for @object, just set the appropriate field in
@object in the controller.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]