Ruby on Rails Tuesday, December 28, 2010

On Dec 28, 2:57 am, "Durga B." <li...@ruby-forum.com> wrote:
> i have a registration form ,i want to store data in corresponding user
> table in that hobbies field
> ,i want to store all hobbies in one column so i take multiple check
> boxes and store in one array
> all checked values for that i am using below tag,but not working,please
> any suggestion
>  <%= check_box(:user ,:hobbies,:value =>'Games') %>Games
>        <%=  check_box  :user , :hobbies,:value =>'Music' %>Music
>          <%= check_box :user , :hobbies,:value => 'Shopping'%>Shopping
> the above user is table name ,hobbies is column name
>
You need to use check_box_tag, and the name of the parameter needs to
end in []. THis will result in params[:foo] being an array which you
an then do something sensible with.

Fred
> --
> Posted viahttp://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment