lib/hobo/scopes/association_proxy_extensions.rb in hobo-0.8.3 vs lib/hobo/scopes/association_proxy_extensions.rb in hobo-0.8.4
- old
+ new
@@ -22,25 +22,35 @@
def conditions_with_hobo_scopes
scope_conditions = self.scope_conditions(@reflection)
unscoped_conditions = conditions_without_hobo_scopes
combine_conditions(scope_conditions, unscoped_conditions)
end
-
alias_method_chain :conditions, :hobo_scopes
end
HasManyThroughAssociationExtensions = classy_module do
- def sql_conditions_with_hobo_scopes
+ def conditions_with_hobo_scopes
scope_conditions = self.scope_conditions(@reflection)
through_scope_conditions = self.scope_conditions(@reflection.through_reflection)
- unscoped_conditions = sql_conditions_without_hobo_scopes
+ unscoped_conditions = conditions_without_hobo_scopes
combine_conditions(scope_conditions, through_scope_conditions, unscoped_conditions)
end
+ alias_method_chain :conditions, :hobo_scopes
+ alias_method :sql_conditions, :conditions
+ public :conditions, :sql_conditions
- alias_method_chain :sql_conditions, :hobo_scopes
-
+ end
+
+ AssociationCollectionExtensions = classy_module do
+
+ def proxy_respond_to_with_automatic_scopes?(method, include_priv = false)
+ proxy_respond_to_without_automatic_scopes?(method, include_priv) ||
+ (@reflection.klass.create_automatic_scope(method) if @reflection.klass.respond_to?(:create_automatic_scope))
+ end
+ alias_method_chain :proxy_respond_to?, :automatic_scopes
+
end
end
end