I am using Rails 4.0.0
with Mongoid and HAML I have the following model structure:
class Merchant
has_one :setting
end
class Setting
belongs_to :merchant
has_many :categories
end
class Category
belongs_to :setting
end
Setting
is layed out as singular resource by intention. So I have these routes:
resources :merchants do
resource :setting, only: [:show, :edit, :update] do
resources :categories
end
end
When I make use of the standard form helpers to create a form for categories like so:
= form_for([@merchant, @setting, @category]) do |f|
and I edit a category, I get the following HTML:
<form accept-charset="UTF-8" action="/merchants/5257cfdf16abe9985c000002/setting/categories/5257cfdf16abe9985c000003" class="edit_category" id="edit_category_525c090a16abe9988f000001" method="post">
which is wrong. The category_id
should be 525c090a16abe9988f000001
as in the form_tag's id
attribute, but is not.
I encounter a similarily strange behaviour with all polymorphic_path helpers when it comes to singular resources. I am sure, I'm doing something wrong here. Or is there a problem with path_helpers and polymorphic_path helpers in Rails 4?