Nested resources in namespace form_for

前端 未结 3 1820
南方客
南方客 2020-12-08 09:53

Problem

The form_for helper incorrectly determines the path to my nested resource inside of a namespace. The models in question are: Forum::

3条回答
  •  囚心锁ツ
    2020-12-08 10:51

    Editted solution in case people don't read the reactions:

    <%= form_for [:admin, @person, @image] do |f| %>
    

    Old response:

    I have a project with an admin namespace and People and Images resources, this is the way I build my form_for in rails3, I haven't found a way just yet to do it cleaner...

    <%= form_for [@person, @image], :url => admin_person_images_path do |f| %>
    

提交回复
热议问题