いくつかの「複雑な」ルーティングがある場合、ハードコードされたリンクの下をクリーンアップして名前付きルートにする良い方法は何でしょうか? 私はいくつかの場所でこの種の構造を持っており、それらをコードから取り出したいと思っています。
profile_controller.rb
def update
@profile = Profile.find(params[:id])
@tags = Session.tag_counts_on(:tags)
@profile.form = params[:form]
@match = Match.where(:user_id => current_user.id).first
authorize! :update, @profile
respond_to do |format|
if @profile.update_attributes(params[:profile])
format.html { redirect_to "/me/#{ current_user.username }/edit/#{ @profile.form }", notice: t('notice.saved') }
else
format.html { render action: "/edit/edit_" + params[:profile][:form], :what => @profile.form }
end
end
end