ActiveRecord after_initialize

August 14, 2009

If you’re using ActiveRececord’s after_initialize like this:

after_initialize :foo_bar

you might end up scratching your head. This “macro” style of using after_initialize does compile, however, it’s simply ignored. So to use after_initialize be sure to do this:

def after_initialize
foo
end

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.