Today I was called by a user stating that something really bad happened. He clicked an actionlink accidently and now data is a mess.
Well after some investigation I ve asked him: Why did you even press ok in confirmation dialog?
The answer was quite a surprise for me cause he told me that there was nt any confirmation dialog.
I ve fixed that today. If you update your activescaffold to latest version, you are save.
However, application will display missing routing error in these special cases.
In my post Actionlink response and ignore I ve described an easy way to respond to actions triggered by an actionlink. I will use it as a base for my example.
First step: Adding a new route
put :fire, : on => :member get :fire, : on => :member
As an alternative you might also add non resource routes, it s important to add them BEFORE the resource routes.
match 'players/:id/fire' => 'players#fire', :via => [:get, :put] resources :player
Second step: Rewrite action method fire in players controller
def fire process_action_link_action do |record| begin record.update_attributes!(:salary => 0) self.successful = true flash[:info] = 'player fired' rescue self.successful = false flash[:error] = 'Internal Error' end end end
New Method process_action_link_action is doing all the magic and in addition should further simplify your action management.