Rails 3 Render => New with Parameter

前端 未结 1 856
无人共我
无人共我 2021-01-15 16:26

I\'v read: Rails: Pass parameters with render :action? ,but I\'m still having problems.

My URL for the new page is: http://localhost:3000/submit?category_id=2. Su

相关标签:
1条回答
  • 2021-01-15 17:05

    I think the else clause of your 'create' method will need to roughly mirror your 'new' method, which means populating @category again from your params hash.

    So first make sure your hidden field is populated, then check the contents of params when the form is submitted. category_id should be there and you'll need to grab it again as you did in 'new', if the save fails.

    0 讨论(0)
提交回复
热议问题