0
我有我的文件控制器的刪除操作的一個奇怪的情況。'刪除'動作發生兩次?
Started GET "/files/35/delete" for 127.0.0.1 at 2011-02-27 01:13:51 -0500
Processing by FilesController#delete as HTML
Parameters: {"id"=>"35"}
SQL (0.3ms) DELETE FROM `files` WHERE (`files`.`id` = 35)
SQL (0.7ms) COMMIT
Redirected to http://localhost:3000/files
Completed 302 Found in 713ms
Started GET "/files/35/delete" for 127.0.0.1 at 2011-02-27 01:13:52 -0500
Processing by FilesController#delete as HTML
Parameters: {"id"=>"35"}
...leads to error
控制器動作:
@file = @company.files.where("id = ?", params[:id]).first
@file.destroy
flash[:notice] = "Your file was deleted successfully."
redirect_to files_url
路線:
resources :files do
member do
get 'delete_ask'
get 'delete'
end
end
你知道爲什麼發生這種情況?