my requirement passing array of ids url , extract them controller method.suppose have ids below.
@userid=[1,2,3,4]
i have link_to
tag below.
<%= link_to "update",users_update_path(:all_id=@userid) %>
in users_controller.rb
file want access id present in @userid variable.
users_controller.rb:
class userscontroller < applicationcontroller def update end end
please me resolve issue.
you can try this, hope help.
<%= link_to "update",users_update_path(params.merge!(:all_id => [1,2,3,4])) %> ## output puts params[:all_id] [1,2,3,4]
Comments
Post a Comment