Forum: Ruby on Rails ruby capitalizing singular version of route

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
588fb9410bae0ee26b7b401d7b55eff5?d=identicon&s=25 Ben Lieber (lieberb)
on 2009-03-13 17:57
Hi All,

I've searched on this topic and can't seem to find anyone results saying
others have had the same problem, so hope someone here can help.

if in routes, I map addresses:
map.resources :addresses

If get the following routes:
addresses
new_Address
edit_Address

Note that the singular routes (new, edit) are capitalized.

to prove the issue, in console, I can type:
>> "addresses".singularize
=> "Address"

and you see it doesn't happen with a word that doesn't require more than
stripping the 's':
>> "routes".singularize
=> "route"

this makes it impossible to use 'form_for @address', etc because it
produces lowercase route call that don't match.

Thanks for any help!

-Ben
588fb9410bae0ee26b7b401d7b55eff5?d=identicon&s=25 Ben Lieber (lieberb)
on 2009-03-13 20:21
Nevermind. I found a custom inflection that had been added by some other
people on the project. Thanks!
4c438a80fc30661ad619ea177cf9cbd0?d=identicon&s=25 Freddy Andersen (Guest)
on 2009-03-13 21:16
(Received via mailing list)
What version of Rails/Ruby are you on?

Loading development environment (Rails 2.2.2)
>> "addresses".singularize
=> "address"
>> "routes".singularize
=> "route"

It works for me
This topic is locked and can not be replied to.