我有屬於實際上,當我想編輯我的個人資料我正在重定向到http://localhost:3000/1/profile
而不是http://localhost:3000/profile
爲什麼用戶的輪廓模型後重定向?這是我的個人資料resource :profile
的Rails:一個行動
路線,這是我的個人資料控制器
before_filter :authenticate_user!
def show
@user = current_user
@profile = @user.profile
end
def update
@user = current_user
@profile = @user.profile
respond_to do |format|
if @profile.update(profile_params)
flash[:notice] = "profile à été mis à jour!"
format.html { redirect_to @profile }
else
format.html { render action: 'edit' }
end
end
end
更新
這是配置文件路徑
profile POST (/:locale)/profile(.:format) profiles#create {:locale=>/en|fr/}
new_profile GET (/:locale)/profile/new(.:format) profiles#new {:locale=>/en|fr/}
edit_profile GET (/:locale)/profile/edit(.:format) profiles#edit {:locale=>/en|fr/}
GET (/:locale)/profile(.:format) profiles#show {:locale=>/en|fr/}
PATCH (/:locale)/profile(.:format) profiles#update {:locale=>/en|fr/}
PUT (/:locale)/profile(.:format) profiles#update {:locale=>/en|fr/}
DELETE (/:locale)/profile(.:format) profiles#destroy {:locale=>/en|fr/}
爲什麼我重定向到http:// localhost:3000/1/profile而不是http:// localhost:3000/profile,您甚至在閱讀它之前已將該問題投下來謝謝 – userails
請張貼您的路線.rb和相關模型的片段。 – vpsz
我的個人資料的路線是資源:配置文件和配置文件模式belongs_to的:用戶 \t \t acts_as_taggable_on:技能 \t \t的has_many:profile_languages accepts_nested_attributes_for:profile_languages ...... – userails