【发布时间】:2014-02-08 04:09:07
【问题描述】:
我收到了这个错误
Pages#home 中的 ActionController::UrlGenerationError 显示 C:/Users/jhakas realstate/Desktop/call/app/views/layouts/application.html.erb 其中第 55 行提出:
没有路由匹配 {:controller=>"refills", :action=>"new"} 缺少必需的密钥:[:user_id, :wallet_id] 提取的源代码(在 #55 行附近): 52 53 54 55 56 57 58
<li class="divider-vertical"></li>
<% if user_signed_in? %>
<li><%= link_to "Dashboard", new_user_wallet_refill_path %></li>
<li><%= link_to "Edit Profile", edit_user_registration_path %></li>
<li><%= link_to "Logout", destroy_user_session_path, method: :delete %></li>
<% else %>
和我在路线中的资源
resources :users do
resources :wallets do
resources :refills
end
end
我的钱包控制器是
def create
@wallet = Wallet.new([:user_id]wallet_params)
respond_to do |format|
if @wallet.save
format.html { redirect_to @wallet, notice: 'Wallet was successfully created.' }
format.json { render action: 'show', status: :created, location: @wallet }
else
format.html { render action: 'new' }
format.json { render json: @wallet.errors, status: :unprocessable_entity }
end
end
end
【问题讨论】:
标签: ruby-on-rails ruby