Welcome Guest | Login

Problems with routing with words with irregular inflections

Hi.

I'm having a problem deploying my rails app.

The thing is that, not being in English, I add the pluralization to the Inflector,eg:
Inflector.inflections do |inflect|
 inflect.irregular 'sing', 'plur'
end
And in the routes.rb:
ActionController::Routing::Routes.draw do |map|
   map.resources :plur
end
I get the following error:
ActionView::TemplateError (plur_url failed to generate from {:controller=>"plur", :action=>"show"} - you may have ambiguous routes, or you may need to supply additional  parameters for this route.  content_url has the following required parameters: ["plur", :id] - are they all satisifed?) on line #10 of app/views/layouts/application.rhtml:
10:                 <%= link_to "Plur", plur_path %>
11:             </li>
I'm confident that the problem is related to the Inflector because if I change the routes.rb to
ActionController::Routing::Routes.draw do |map|
   map.resources :plur, :singular => "sing", :plural => "plur"
end
it works again (and the problem only appears with the irregularly inflected words).

Does someone have a clue why this happens?

(Of course I can leave the :singular and :plural bits in the routes.rb, but I'd like to know why this happens.)

2007-09-05 08:35 PM

Don't quote me on this, but I believe the route requires that a default :singular and :plural be given, which is why it works in that case.  If it doesn't affect anything else in your app and works as expected, probably best to leave it with this fix.  

2007-09-07 03:29 AM

Ok, I'll stick with what I have.

Thanks for the help, though.

2007-09-13 05:14 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.