Ruby on rails 行动';破坏性';在控制器中找不到
我想我要失去它了。我不明白为什么一个简单的销毁链接会突然失效 我得到了这个错误: AbstractController::ActionNotFound位于/plans/v41w74v2 找不到PlansController的操作“销毁” 计划控制员:Ruby on rails 行动';破坏性';在控制器中找不到,ruby-on-rails,Ruby On Rails,我想我要失去它了。我不明白为什么一个简单的销毁链接会突然失效 我得到了这个错误: AbstractController::ActionNotFound位于/plans/v41w74v2 找不到PlansController的操作“销毁” 计划控制员: class PlansController < ApplicationController before_filter :authenticate_user! def index @plans = Plan.all end def ne
class PlansController < ApplicationController
before_filter :authenticate_user!
def index
@plans = Plan.all
end
def new
@plan = Plan.new
end
def create
@plan = Plan.new(plan_params)
if @plan.save
if @plan.trips.empty?
@possible = @plan.group.trips
render "add_trips"
else
redirect_to plans_path, notice: "Plan successfully created"
end
else
render "new"
end
end
def show
@plan = Plan.find_by_unique_identifier(params[:id])
end
def edit
@plan = Plan.find_by_unique_identifier(params[:id])
@group = @plan.group
@possible = @plan.group.trips
render "add_trips"
end
def update
@plan = Plan.find_by_unique_identifier(params[:id])
if @plan.update_attributes(plan_params)
redirect_to plans_path, notice: "Plan successfully updated!"
else
render "edit"
end
end
def add_trips
@plan = Plan.find_by_unique_identifier(params[:id])
trip.each.update_attributes(plan_id: @plan.id)
redirect_to plans_path, notice: "Trips added to plan"
end
def destory
@plan = Plan.find_by_unique_identifier(params[:id])
@plan.destroy
end
类平面控制器
平面视图:
<%= button_to "Delete", @plan, method: :delete, data: { confirm: "Are you sure you want to delete this plan?"} %>
我做错了什么?是的。你打错了<代码>销毁