如何在Rails 3中呈现操作并设置URL?

时间:2012-09-04 02:39:53

标签: ruby-on-rails ruby-on-rails-3 controllers

如何render :new并将位置设置为question/:id/new/answer

render :location => new_question_path将位置设置为question/:id/answer

render :location => "/question/#{params[:id]}/new/answer"也无效。

相关路线:get '/question/:id/new/answer' => 'answers#new', as: :new_answer

1 个答案:

答案 0 :(得分:2)

可能正在使用

resources :questions do
  get 'new/answer', :on => :member
end

并将通过rake routes

查看路径