这是我在路线路由文件的ActionController :: UrlGenerationError在帐户#计划
get '/signup/:plan/:discount' =>'accounts#new', plan: nil, discount: 0, as: :new_account
而且我打电话我的html文件,这个路线如下图所示
<a href="<%= new_account_url('$129', params[:discount]) %>" class="signup"><img src="/images/sign-up.png"></a>
后耙航线运行命令后端然后我得到以下
new_account GET /signup/:plan/:discount(.:format)
accounts#new {:plan=>nil, :discount=>0}
但我不知道它给出的路线有什么问题我错误,如
No route matches {:action=>"new", :controller=>"accounts", :discount=>nil, :format=>nil, :plan=>"$129"} missing required keys: [:discount]
'params [:discount]'的价值是什么? – Pavan
也尝试将路线中的折扣:零折扣改为折扣:零。 – Pavan
我也尝试打折作为零,但仍然无法正常工作。和params [:折扣]是不是强制性的价值时,那么它取代零或零。 –