我在页面上有此按钮:
<%= link_to 'Approve', {:action => "approve", :controller => "daily_balance_reconciliations", :method => :get}, class: 'btn btn-primary' %>
我已经在 routes.rb 中定义了此内容:
get "/daily_balance_reconciliations/approve" => "daily_balance_reconciliations#approve", :as => :approve_daily_balance_reconciliations
我在 daily_balance_reconciliations_controller.rb 中定义了此方法:
def approve
puts "*************************approve*********************************"
@daily_balance_reconciliation = DailyBalanceReconciliation.all
DailyBalanceReconciliation.all.update_all(approved: true)
redirect_to daily_balance_reconciliations_url, notice: "All the Daily Balance Records are approved"
end
我的控制器中的上述方法永远不会被调用; puts语句中的消息永远不会在我的控制台上打印。
我在这里做错了什么?请帮忙!