Topic: Edit form fill action with a wrong locale
Hi all.
I'm using rails 3.2 and I have an issue with all my edit forms.
I'm using a namespace (admin) and nested resources, also I'm using internationalization.
This is my routes.rb:
scope "(:locale)", :locale => /en|it/ do
...
namespace :admin do
resources :manufacturers do
resources :articles, :except => [:index] do
resources :article_images, :except => [:index, :show]
end
end
end
endFor instance I'm using this form for articles:
<%= form_for([:admin, :manufacturer, @article]) do |f| %>But it generates this action in the form:
<form id="edit_article_3" class="edit_article" method="post" action="/3/admin/manufacturers/1/articles/3" accept-charset="UTF-8">
And I get a routing error:
No route matches [PUT] "/3/admin/manufacturers/1/articles/3"I also tried this:
<%= form_for(admin_manufacturer_articles_path(@article)) do |f| %>and this:
<%= form_for(admin_manufacturer_articles_path(@article, locale: nil)) do |f| %>But the fields of the form are "wrong":
<input id="_3_admin_manufacturers_1_articles_name" class="span6" type="text" size="30" name="/3/admin/manufacturers/1/articles[name]">What is wrong in my codes?
How can I get my edit forms working?
Thanks to all.