我有一些非常奇怪的rails行为:
路线.rb:
resources :transactions, except: :show
rake 路由的相关输出:
transactions GET /transactions(.:format) transactions#index
POST /transactions(.:format) transactions#create
new_transaction GET /transactions/new(.:format) transactions#new
edit_transaction GET /transactions/:id/edit(.:format) transactions#edit
transaction PUT /transactions/:id(.:format) transactions#update
DELETE /transactions/:id(.:format) transactions#destroy
视图中的代码:
<% if ( current_page?( new_transaction_path ) || current_page?( edit_transaction_path ) ) %>
# Do something in here
<% end %>
错误:
Completed 500 Internal Server Error in 20ms
ActionController::RoutingError (No route matches {:action=>"edit", :controller=>"transactions"}):
当我卸下|| current_page?( edit_transaction_path )
零件时它起作用。
我有什么问题还是这是一个错误?