我有此鏈接:爲什麼我會收到路由錯誤?
<%= link_to "Profile", user_profile_path(current_user) %>
,它給了我一個路由錯誤,當我試圖在配置文件控制器訪問演出。
這裏是我的routes.rb:
resources :users do
resources :profiles
end
這是我的節目在配置文件控制方法:
def show
@profile = @user.profiles.find(params[:id])
end
我也有這個回調在我的用戶模型:
before_create :build_profile
我做錯了什麼?
用戶有很多的配置文件? – 2011-03-27 03:33:45
哦,沒有,只有一個... – 2011-03-27 03:34:38
我應該將其更改爲'@profile = @ user.profile.find(PARAMS [:編號])'呢? – 2011-03-27 03:37:04