Commit b234ea9e1ed6f8c4e25849b3420f6584b5ae43b3

Authored by Maxim Stukalo
1 parent feadb8f2
Exists in master

Use AR #where instead of #order in #apply_options_to_scope for option with condition

lib/acts_as_follower/follower_lib.rb
... ... @@ -22,7 +22,7 @@ module ActsAsFollower
22 22 scope = scope.joins(options[:joins])
23 23 end
24 24 if options.has_key?(:where)
25   - scope = scope.order(options[:where])
  25 + scope = scope.where(options[:where])
26 26 end
27 27 if options.has_key?(:order)
28 28 scope = scope.order(options[:order])
... ...
test/acts_as_follower_test.rb
... ... @@ -134,9 +134,13 @@ class ActsAsFollowerTest < ActiveSupport::TestCase
134 134 assert_equal [], @jon.all_following
135 135 end
136 136  
137   - should "accept AR options" do
  137 + should "accept AR limit option" do
138 138 assert_equal 1, @sam.all_following(:limit => 1).count
139 139 end
  140 +
  141 + should "accept AR where option" do
  142 + assert_equal 1, @sam.all_following(:where => { :id => @oasis.id }).count
  143 + end
140 144 end
141 145  
142 146 context "following_by_type" do
... ...