Skip to content

Instantly share code, notes, and snippets.

View nazar's full-sized avatar

Nazar Aziz nazar

  • Clevertech
  • Newlyn, Cornwall, United Kingdom
View GitHub Profile
module ActiveRecord
class Reflection::AssociationReflection
# Return a named scope instead of the bare ActiveRecord::Base subclass.
def klass_with_scope
k = klass_without_scope
options[:scope].nil? ? k : k.send(options[:scope])
end
alias_method_chain :klass, :scope
end