我试图破坏铁轨后(照片),但它一直引导到该职位的show'page。
意见/照片/ index.html.erb
<td><%= link_to 'Destroy', photo, method: :delete, data: { confirm: 'Are you sure?' } %></td>
路线
resources :photos
resources :billets
devise_for :users
get 'information/index'
get 'information/afficher'
root to: 'information#index'
get "*path" => redirect("/")
当我点击的照片”指数销毁记录的权利
Started GET "/photos/1" for 127.0.0.1 at 2014-05-23 19:13:22 -0400
Processing by PhotosController#show as HTML
Parameters: {"id"=>"1"}
User Load (0.1ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
Photo Load (0.1ms) SELECT `photos`.* FROM `photos` WHERE `photos`.`id` = 1 LIMIT 1
------------ With this action I will SHOW the given Photo------
Rendered photos/show.html.erb within layouts/application (0.8ms)
Completed 200 OK in 13ms (Views: 9.9ms | ActiveRecord: 0.2ms)
我摧毁行动
def destroy
puts "With this action I will destroy the given Photo"
@photo.destroy
respond_to do |format|
format.html { redirect_to photos_url }
format.json { head :no_content }
end
end