Published on December 19, 2006

Journey in ActiveSupport

Hey, this post is vintage content. It dates back more than 17 years ago: it may contain outdated and inaccurate information.

Away Rails on the road I stumbled upon an interesting post by Err the blog: a nice trip through ActiveSupport, the component of Rails that takes care of extending Ruby's default library.

I'm also posting this here to avoid wasting time every time I look for the right method of Inflector:

>> "reindeer".pluralize
=> "reindeers"
>> "elves".singularize
=> "elf"
> "christmas_carol".camelize
=> "ChristmasCarol"
> "christmas_carol".camelize(:lower)
=> "christmasCarol"
> "holiday_cheer".titleize
=> "Holiday Cheer"
> "AdventCalendar-2006".underscore
=> "advent_calendar_2006"
> "santa_Claus".dasherize
=> "santa-Claus"
> "Holiday::December::Christmas".demodulize
=> "Christmas"
> "SnowStorm".tableize
=> "snow_storms"
> "snow_storms".classify
=> "SnowStorm"
> "present_id".humanize
=> "Present"
> "Present".foreign_key
=> "present_id"
>> "cheer".constantize
NameError: uninitialised constant Cheer
>> "Christmas".constantize
=> Christmas



20 years later

December 20, 2006

I am Silvano Stralla. I am a developer, I like taking photos and riding bikes.
If you want, you can write to me at silvano.stralla at
This site is handmade, with love, in Turin (Italy).

© 2002—2024 Silvano Stralla

This page was built on Sun, 14 Jul 2024 11:45:34 GMT from code version a494c001.