diff --git a/lib/acts_as_follower/follower_lib.rb b/lib/acts_as_follower/follower_lib.rb index 25aec39..2bd01b4 100644 --- a/lib/acts_as_follower/follower_lib.rb +++ b/lib/acts_as_follower/follower_lib.rb @@ -22,7 +22,7 @@ def apply_options_to_scope(scope, options = {}) scope = scope.joins(options[:joins]) end if options.has_key?(:where) - scope = scope.order(options[:where]) + scope = scope.where(options[:where]) end if options.has_key?(:order) scope = scope.order(options[:order]) diff --git a/test/acts_as_follower_test.rb b/test/acts_as_follower_test.rb index 535195b..59b8f8c 100644 --- a/test/acts_as_follower_test.rb +++ b/test/acts_as_follower_test.rb @@ -134,9 +134,13 @@ class ActsAsFollowerTest < ActiveSupport::TestCase assert_equal [], @jon.all_following end - should "accept AR options" do + should "accept AR limit option" do assert_equal 1, @sam.all_following(:limit => 1).count end + + should "accept AR where option" do + assert_equal 1, @sam.all_following(:where => { :id => @oasis.id }).count + end end context "following_by_type" do