How is form data sent to the conntroller?

I’m trying to implement a bunch of checkboxes whose value I need to use
to process more code without updating the db.

This is my code to for the checkbox in my view
input type=checkbox id=<%=search.name%>_selected
name=<%=search.name%>[selected]>

I guess my question is, when I’m back in the controller, how do I get at
the actual value (checked or unchecked)? It doesn’t seem like that’s an
attribute

The form values are returned in the hash-like object “params”.

So params[‘name’] would get you the value of the checkbox with a name of
‘name’.

Also, see the ActionView::Helpers::FormHelper page in the api at
http://api.rubyonrails.org/

Rails helpers can generate the checkbox code for you. check_box() is
for data going to or from a model object. check_box_tag() is for
non-model data.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs