Skip to content

Instantly share code, notes, and snippets.

@akahn
Forked from hardbap/custom_getters.rb
Created May 3, 2010 19:17
Show Gist options
  • Save akahn/388476 to your computer and use it in GitHub Desktop.
Save akahn/388476 to your computer and use it in GitHub Desktop.
class Post < ActiveRecord::Base
has_many :authors
attr_accessor :post_authors
memoize :post_authors
def post_authors
process_post_authors
end
private
def process_post_authors
# do some expensive stuff here
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment