Sha256: 7bf121e35f5459d0c084a2d5dcf0d530bcf9f2c927969e7cc2a25278c9405ba0
Contents?: true
Size: 842 Bytes
Versions: 1
Compression:
Stored size: 842 Bytes
Contents
# Add support for :scope => :my_scope to has_many and :belongs_to module Hobo module Scopes module AssociationProxyExtensions def self.included(base) base.class_eval do alias_method_chain :conditions, :hobo_scopes end end def conditions_with_hobo_scopes scope_conditions = if (scope_name = @reflection.options[:scope]) target_class = @reflection.klass target_class.send(scope_name).scope(:find)[:conditions] end if scope_conditions && conditions_without_hobo_scopes "#{conditions_without_hobo_scopes} AND #{scope_conditions}" else scope_conditions || conditions_without_hobo_scopes end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hobo-0.7.3 | hobo_files/plugin/lib/hobo/scopes/association_proxy_extensions.rb |