Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPeter Lawless
24,404 PointsSingular/Plural model names in Rails
Can somebody help me understand how rails keeps track of model names, especially when the plural name is not just the singular with an 's' tacked on the end? In these videos on ActiveRecord in particular, I don't understand how rails knows that "time_entries" is the plural of "TimeEntry" or vice versa.
1 Answer
Seth Kroger
56,413 PointsRails has a number of utility functions like underscore/camelize and pluralize/singularize that handle transforming one name to another. They are in a module called ActiveSupport::Inflector