Tag Archives: active record

Custom foreign keys on Ruby on Rails Active Record

ActiveRecord, like all ORM’s, is one of the greatest things on earth, IMHO :)

By using the Convention or Configuration approach, ActiveRecord and even Rails, allows you to skip a few parts and go straight to what matters: the development.

sometimes, though, the “Sensible defaults” of rails and ActiveRecord are’t enough, but like most ORM’s, the convention can easily be overridden in order to get things done.

When you add a relationship between classes all you have to do is to add a references and has_many on the other side. If you follow the naming rules everything works.

Continue reading “Custom foreign keys on Ruby on Rails Active Record” »