Skip to content

Instantly share code, notes, and snippets.

@geoffreyd
Created June 10, 2009 08:09
Show Gist options
  • Save geoffreyd/127085 to your computer and use it in GitHub Desktop.
Save geoffreyd/127085 to your computer and use it in GitHub Desktop.
module ActiveRecord
module NamedScope
class Scope
def conditions
@conditions ||= begin
all_conditions = []
scope = self
while scope.class == self.class
all_conditions << scope.proxy_options[:conditions]
scope = scope.proxy_scope
end
merge_conditions(*all_conditions)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment