0
所以我的路線是:Rails的無路由匹配的網址
match '/user/:username/' => 'user/account/home#index', via: [ :get ], as: :user_view, constraints: UserConstraint
和控制器的代碼是:
class User::Account::HomeController < User::ApplicationController
def index
@account = User.find_by_username(params[:username])
end
end
然而,當我將其稱爲URL(即; http://example.com/user/xerax),這是該軌錯誤在我拋出:
No route matches {:controller=>"user/account/home", :username=>nil}
編輯:我使用Rails 3.2.13
您使用的是什麼版本的導軌 – klaffenboeck
已更新我的原始帖子 –