nested form_for singular resource

浪尽此生 提交于 2019-11-30 23:49:01

I think form_for assumes all nested resources are plural resources. Fixing form_for would be the correct thing to do (and I urge you to submit a bug), but in the mean time, you can fake it:

# in app/helpers/application_helper.rb
module ApplicationHelper

  def booking_reviews_path(*args)
    booking_review_path(*args)
  end

end

You can't use alias_method because the method booking_review_path doesn't exist in that module, but this is essentially the same thing.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!