Rajan AgaskarRajan Agaskar
Standup 10/31/08
edit Posted by Rajan Agaskar on Friday October 31, 2008 at 04:27PM

Interesting Things

  • Aliasing ActiveRecord reader methods

    ActiveRecord reader methods are not eagerly loaded, and as such cannot be aliased using alias_method. There are a number of workarounds to this, those talked about included: calling self.define_read_methods, after which all your read methods will be loaded and available for aliasing, or you can simply define the alias instead of using alias_method.

  • belongs_to and foreign keys.

    If you specify an alternate foreign key when using belongs to, you will have access to that id via the name of the foreign key, and not the name of the belongs_to association. It may be worthwhile allowing access to the id via the belongs_to association in order to keep consistency.

  • boo

    BOOOO!!!!! BOOOOOOOOO!

Comments

  1. Strass Strass on October 31, 2008 at 06:36PM

    You could also use alias_attribute : http://noobkit.com/show/ruby/rails/rails-stable/activesupport/module/alias_attribute.html