Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Test ordering by polymorphic field

  • Loading branch information...
commit b3eb5e29fa8f01fb26b1bfda23b33a2e362f9b38 1 parent a9e3887
@nandalopes nandalopes authored
View
4 spec/searchlogic/named_scopes/association_ordering_spec.rb
@@ -24,4 +24,8 @@
it "should work through #order" do
Company.order('ascend_by_users_username').proxy_options.should == Company.ascend_by_users_username.proxy_options
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
View
1  spec/spec_helper.rb
@@ -99,6 +99,7 @@ class ::User < ActiveRecord::Base
belongs_to :company, :counter_cache => true
has_many :orders, :dependent => :destroy
has_many :orders_big, :class_name => 'Order', :conditions => 'total > 100'
+ has_many :audits, :as => :auditable
has_and_belongs_to_many :user_groups
self.skip_time_zone_conversion_for_attributes = [:whatever_at]
Please sign in to comment.
Something went wrong with that request. Please try again.