Hi all,
I’m trying to edit multiple objects in a database by adding checkboxes
to a tableview.
For reference I’m using rails casts #165 as my guide.
The problem is my button created by the submit_tag does nothing! it
appears to click, but doesn’t go anywhere, and the method in the
controller never gets run. If anyone had any ideas I’d be very grateful!
My form is built like this (it’s haml if you’re wondering about the
syntax)
######index
%h2 All Events
-form_tag multi_params_edit_admin_events_events_path do
%table.list
= render :partial => “admin/events/events/events_table”, :locals
=> {:events => @all_events}
########table
…
%td= check_box_tag “is_ten_event_ids[]”, event.id
%td= check_box_tag “is_all_event_ids[]”, event.id
########sidebar
…
= submit_tag “save changes”, :class => “button save”
the route is added with this:
resources :events do
collection do
post :multi_params_edit
end
end
and the multi_params_edit_admin_events_events_path appears as a post
request, with correct action in ‘rake routes’
in the controller, I’m just testing to see if I can get to the method
for now
def multi_params_edit
@events = Event.find(params[:is_ten_event_ids])
logger.debug"I was ere"
redirect_to (:action =>:index)
end
I click the button and nothing happens! Thought it might be because the
button is in a different view, but this layout works fine for submitting
‘new events’ forms / updating events.
All help appreciated
Mike