-
-
Save hardbap/388474 to your computer and use it in GitHub Desktop.
Revisions
-
hardbap revised this gist
May 3, 2010 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,16 +4,15 @@ class Post < ActiveRecord::Base attr_accessor :post_authors_cache def post_authors_cache @post_authors_cache ||= process_post_authors end private def process_post_authors #do some crazy stuff here and set the post_authors_cache #some crazy hash of stuff based on some inane business logic end end -
tcocca created this gist
May 3, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ class Post < ActiveRecord::Base has_many :authors attr_accessor :post_authors_cache def post_authors process_post_authors if post_authors_cache.nil? post_authors_cache end private def process_post_authors #do some crazy stuff here and set the post_authors_cache self.post_authors_cache = {} #some crazy hash of stuff based on some inane business logic end end