Where does Rails convert "Person" to "people", "Car" to "cars"?

We know Rails convert "Car" to "cars" when creating tables and so. Or, "Person" to "people". So, I'm sure there are rules that apply to "Car" and there are data to particular cases like "Person".

Being brazilian, modeling a database in Portuguese doesn't work well on Rails. I know enough to develop it in English, but I must develop a particular database in Portuguese, so others can read it "natively"...

So, my question: where's this database containing "Person". If I find it, I can include the rules for Portuguese and the exceptional words into the database. Does someone know where they are?

ActiveSupport

Go find inflector.rb

Jason

This is the job of the inflector. You can customise these mappings, eg

Inflector.inflections do |inflect|     inflect.plural /^(ox)$/i, '\1en'     inflect.singular /^(ox)en/i, '\1'     inflect.irregular 'person', 'people'     inflect.uncountable %w( fish sheep ) end

(this is straight from example stuff in environment.rb)

You proabably want to replace the whole thing, the default set are in activesupport/lib/active_support/inflections.rb

Fred

QuintellaRosa wrote:

We know Rails convert "Car" to "cars" when creating tables and so. Or, "Person" to "people". So, I'm sure there are rules that apply to "Car" and there are data to particular cases like "Person".

Being brazilian, modeling a database in Portuguese doesn't work well on Rails. I know enough to develop it in English, but I must develop a particular database in Portuguese, so others can read it "natively"...

So, my question: where's this database containing "Person". If I find it, I can include the rules for Portuguese and the exceptional words into the database. Does someone know where they are?    You are looking for a way to define or use custom inflections. This will get you started. devchix.com at Directnic

By the way, you can also consider a non-traditional schema as being a "legacy" schema and use some of the tips and tricks mentioned here: http://wiki.rubyonrails.org/rails/pages/HowToUseLegacySchemas

Hope this helps.

Cheers, Mohit. 10/30/2007 | 1:39 AM.

THANK YOU very much, both of you!