Rails Routes Namespaces and form_for

后端 未结 2 772
一向
一向 2020-12-04 07:56

I have namespace in my routes.rb

  namespace :businesses do
    resources :registration
  end

My controller is in a subdirectory businesses

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 08:39

    Actually, I think there is a better solution.

    form_for [:admin, @business]
    

    the issue with giving a url is that if you abstract the form out as a partial view, you'll need to deal with "create" and "update" situations. They points to different urls, and ends up with providing the @url in controller.

提交回复
热议问题