Permalink
Browse files

scope_builder can now be called on association proxy

  • Loading branch information...
1 parent 7205357 commit e3f70f5462f4ad1c29b4d63ac36347e5bee23a9b @ryanb committed Aug 28, 2008
Showing with 10 additions and 0 deletions.
  1. +4 −0 lib/scope_builder/model_additions.rb
  2. +6 −0 spec/scope_builder/builder_spec.rb
@@ -11,3 +11,7 @@ def scope_builder
class ActiveRecord::Base
extend ScopeBuilder::ModelAdditions
end
+
+class ActiveRecord::Associations::AssociationProxy
+ include ScopeBuilder::ModelAdditions
+end
@@ -63,5 +63,11 @@
builder = @category.products.released.scope_builder
builder.all.should == @category.products.released.all
end
+
+ it "should work directly on assocation" do
+ builder = @category.products.scope_builder
+ builder.released
+ builder.all.should == @category.products.released.all
+ end
end
end

0 comments on commit e3f70f5

Please sign in to comment.