Sha256: feb30dcdfbe63cfd8780d249d4ac729a7f57599451ae262be6f803e4e19988dc
Contents?: true
Size: 1.05 KB
Versions: 29
Compression:
Stored size: 1.05 KB
Contents
module Hobo module Model module Scopes def self.included_in_class(klass) klass.class_eval do extend ClassMethods metaclass.alias_method_chain :valid_keys_for_has_many_association, :scopes metaclass.alias_method_chain :valid_keys_for_has_one_association, :scopes metaclass.alias_method_chain :valid_keys_for_belongs_to_association, :scopes end end module ClassMethods include AutomaticScopes include ApplyScopes # --- monkey-patches to allow :scope key on has_many, has_one and belongs_to --- def valid_keys_for_has_many_association_with_scopes valid_keys_for_has_many_association_without_scopes + [:scope] end def valid_keys_for_has_one_association_with_scopes valid_keys_for_has_one_association_without_scopes + [:scope] end def valid_keys_for_belongs_to_association_with_scopes valid_keys_for_belongs_to_association_without_scopes + [:scope] end end end end end
Version data entries
29 entries across 29 versions & 1 rubygems