Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup options[:scrooge_callsite] in .find

  • Loading branch information...
commit 7f1f56b8960073407f694e898e1693457c06c156 1 parent 523e63b
@methodmissing authored
View
10 lib/optimizations/associations/macro.rb
@@ -27,7 +27,7 @@ def scrooge_installable?
module SingletonMethods
@@preloadable_associations = {}
- FindAssociatedRegex = /preload_associations|preload_one_association/
+ FindAssociatedRegex = /preload_associations|preload_one_association|find_associated_records/
def self.extended( base )
eigen = class << base; self; end
@@ -48,10 +48,10 @@ def find_with_scrooge(*args)
options = args.extract_options!
validate_find_options(options)
set_readonly_option!(options)
-
- if (_caller = caller).grep( FindAssociatedRegex ).empty?
- cs_signature = callsite_signature( _caller, options.except(:conditions, :limit, :offset) )
- options[:scrooge_callsite], options[:include] = cs_signature, scrooge_callsite(cs_signature).preload( options[:include] )
+
+ options[:scrooge_callsite] = callsite_signature( (_caller = caller), options.except(:conditions, :limit, :offset) )
+ if _caller.grep( FindAssociatedRegex ).empty?
+ options[:include] = scrooge_callsite(options[:scrooge_callsite]).preload( options[:include] )
end
case args.first
View
6 lib/optimizations/columns/macro.rb
@@ -140,8 +140,8 @@ def destroy_with_scrooge
#
def becomes_with_scrooge(klass)
if scrooged?
- self.class.scrooge_callsite(@attributes.callsite_signature).columns.each do |attrib|
- klass.scrooge_seen_column!(@attributes.callsite_signature, attrib)
+ self.class.scrooge_callsite(callsite_signature).columns.each do |attrib|
+ klass.scrooge_seen_column!(callsite_signature, attrib)
end
end
becomes_without_scrooge(klass)
@@ -172,7 +172,7 @@ def respond_to_with_scrooge?(symbol, include_private=false)
# Expose this record's callsite signature
#
def callsite_signature
- scrooged? ? @attributes.callsite_signature : nil
+ @attributes.callsite_signature
end
private
Please sign in to comment.
Something went wrong with that request. Please try again.