Skip to content

Commit

Permalink
Handle #after_initialize && #after_find
Browse files Browse the repository at this point in the history
  • Loading branch information
methodmissing committed Mar 15, 2009
1 parent 1810157 commit 4289c3a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/optimizations/columns/macro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ def callsite_sql( sql )

module InstanceMethods

ScroogeSpecialCallbacks = Set[:after_find,:after_initialize]

def self.included( base )
base.alias_method_chain :delete, :scrooge
base.alias_method_chain :destroy, :scrooge
base.alias_method_chain :respond_to?, :scrooge
base.alias_method_chain :callback, :scrooge
end

# Is this instance being handled by scrooge?
Expand Down Expand Up @@ -153,6 +156,14 @@ def respond_to_with_scrooge?(symbol, include_private=false)

private

# Handle #after_find and #after_initialize.
# Dog ugly inspect hack - couldn't get anyting else going
#
def callback_with_scrooge( method )
self.inspect if ScroogeSpecialCallbacks.include?( method.to_sym )
callback_without_scrooge( method )
end

# Flag Marshal dump in progress
#
def scrooge_dump_flag_this
Expand Down

0 comments on commit 4289c3a

Please sign in to comment.