Skip to content

Commit

Permalink
Test ordering by polymorphic field
Browse files Browse the repository at this point in the history
  • Loading branch information
nandalopes committed Nov 8, 2010
1 parent a9e3887 commit b3eb5e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/searchlogic/named_scopes/association_ordering_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@
it "should work through #order" do it "should work through #order" do
Company.order('ascend_by_users_username').proxy_options.should == Company.ascend_by_users_username.proxy_options Company.order('ascend_by_users_username').proxy_options.should == Company.ascend_by_users_username.proxy_options
end end

it "should ascend with a polymorphic belongs to" do
Audit.ascend_by_auditable_user_type_username.proxy_options.should == User.descend_by_username.proxy_options.merge(:joins => :users)
end
end end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class ::User < ActiveRecord::Base
belongs_to :company, :counter_cache => true belongs_to :company, :counter_cache => true
has_many :orders, :dependent => :destroy has_many :orders, :dependent => :destroy
has_many :orders_big, :class_name => 'Order', :conditions => 'total > 100' has_many :orders_big, :class_name => 'Order', :conditions => 'total > 100'
has_many :audits, :as => :auditable
has_and_belongs_to_many :user_groups has_and_belongs_to_many :user_groups


self.skip_time_zone_conversion_for_attributes = [:whatever_at] self.skip_time_zone_conversion_for_attributes = [:whatever_at]
Expand Down

0 comments on commit b3eb5e2

Please sign in to comment.