Sha256: ec8631ba22c642e4069c37aab60fdcd6e6e8949db673bb49b6133e7b2c711149

Contents?: true

Size: 425 Bytes

Versions: 23

Compression:

Stored size: 425 Bytes

Contents

class VendorTabulatrData < Tabulatr::Data

  column :name
  column :url
  column :active

  filter :product_price_range do |relation, value|
    relation = relation.joins(:products)
    if value == 'low'
      relation.group("vendors.id").having('AVG(products.price) <= ?', @controller.split)
    elsif value == 'high'
      relation.group("vendors.id").having('AVG(products.price) > ?', @controller.split)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
tabulatr2-0.10.4 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.10.3 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.10.2 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.10.1 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.10.0 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.48 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.47 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.46 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.45 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.44 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.43 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.42 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.41 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.40 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.39 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.38 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.37 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.36 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.35 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb
tabulatr2-0.9.34 spec/dummy/app/tabulatr_data/vendor_tabulatr_data.rb