View Full Version : Ruby on rails checkboxes?

May 20, 2008, 08:03 AM
I don't know if you guys know anything about Ruby on Rails..but I'm not sure how to use the f.check_box...I get how to put it onto my page etc, but I don't know how I check to see if it's checked. What is the method supposed to do that is included in the parameters of the check box? Thanks for any help!

May 20, 2008, 08:56 AM
you need to have a model in the back.

<% form_for(@user) do |f| %>
<%= f.check_box :active %>
<%= f.submit "Update" %>
<% end %>

Hence there needs to be an boolean attribute "active" in the user-model.


May 20, 2008, 09:47 AM
Got it working using the database =) Thanks for the response though!