【发布时间】:2020-05-30 03:40:35
【问题描述】:
目前我有两个模型,Account 和 User。账号有很多用户,用户属于账号。我想显示帐户页面,但不断收到No route matches {:action=>"show", :controller=>"accounts"}, missing required keys: [:id] 错误。
Accounts控制器
def show
@account = Account.find_by(params[:id])
end
帐户页面的链接
<%= link_to "Account Settings", account_path %>
路线
resources :accounts, only: [:new, :create, :show, :edit, :update]
【问题讨论】:
标签: ruby-on-rails controller routes