Skip to content

Instantly share code, notes, and snippets.

@ql
Created May 27, 2010 18:02
Show Gist options
  • Save ql/416124 to your computer and use it in GitHub Desktop.
Save ql/416124 to your computer and use it in GitHub Desktop.
$ cat config/initializers/scopes_patch.rb
class ActiveRecord::Base
class << self
def def_scope(name, options={}, &block)
_name = name.to_sym
named_scope(_name, block || options)
_scope = scopes[_name]
send(:subclasses).each do |k|
k.scopes[_name] = _scope
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment