arrange method incorrect work if using joins models #96

Closed
ermolaev opened this Issue Jul 24, 2012 · 0 comments

1 participant

@ermolaev
class Property < ActiveRecord::Base
  has_ancestry :cache_depth => true

  has_many :product_properties, :dependent => :delete_all
  has_many :products, :through => :product_properties

  default_scope order('ordinal')
end


# incorrect work
@properies = Property
      .select('properties.*, product_properties.value')
      .joins(:product_properties)
      .where(product_properties: {product_id: @product.id})
      .arrange

# correct work
@properies = Property
      .select('properties.*')
      .arrange
@ermolaev ermolaev closed this Jul 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment