Sure, it''s easy. Just append your parameter with empty brackets ([]):
<%= check_box_tag ''limit[]'', ''dog'' %>
<%= check_box_tag ''limit[]'', ''cat'' %>
Your URL will end up looking like:
/my_controller/my_action?group=users&limits[]=dog&limits[]=cat&limits[]=bird
And params[:limit] will be an array.
Brandon
On Mon, May 19, 2008 at 3:17 AM, michael_teter
<michael.teter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
>
> Howdy.
>
> I''m not sure what the right way to do this is. I basically need
to
> pass an array in via GET to my controller action.
>
> For a little background, here''s what''s going on from the
user''s
> perspective:
>
> User clicks some checkboxes in my YUI DataTable, thereby marking some
> rows.
> User then clicks something that causes me to gather up a list of the
> selected items, then set those as a new request for another DataTable.
>
> My controller gets these request params, builds a conditions list, and
> fetches records from my model.
>
> For example, my URL would be something like this:
> /my_controller/my_action?group=users&limits=dog,cat,bird
>
> Then in my_action(), I want to use params[:limits] in conjunction
> with
> my_model.find(:all, :conditions => { [animal in (?)],
> params[:limits] } )
>
> (My syntax may be off in my example, but hopefully my goal is clear.)
>
> Thanks!
> >
>
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---