On 17 Sep 2008, at 10:41, Sijo Kg wrote:
>
> Hi
> Thanks for the reply I tried like
> <% for language in @languages %>
> <%= language.language %> <%=
> check_box_tag("user[#{language.id}][]","#{language.id}") %>
> <% end %>
> And the source obtained is
> English <input id="user[1][]" name="user[1][]" type="checkbox"
> value="1"
> />
> Spanish <input id="user[2][]" name="user[2][]" type="checkbox"
> value="2"
> />
> Persian <input id="user[3][]" name="user[3][]" type="checkbox"
> value="3"
> />
>
> Is this correct?Then how can I access this in controller and to
> know
> which one is clicked and which one not?
>
no - you want the output to be
<input id="user[language_id][]" name="user[language_id][]"
type="checkbox" value="3" />
and then params[:user][:language_id] will be an array
Fred
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---