我的代码中出现了错误:
未定义方法错误(尝试调用私有方法): app/controllers/project_evaluations_controller.rb:94:in `calculate'
样例代码:对于控制器的 Index & Show 方法没有提及。
class ProjectEvaluationsController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:index, :show]
def calculate
@project_id = params[:id]
@costs_last_calculated = Time.now.utc
@total_internal_hours = 10
@total_external_hours = 20
@project_evaluation.update(:internal_hours => @total_internal_hours, :external_hours => @total_external_hours, :costs_last_calculated => @costs_last_calculated)
render :action=>"show"
end
end
路由:
resources :project_evaluations do
match "calculate", :on => :collection
end
提出任何解决方案!!!