ref: master
plugins/products/lib/ext/environment.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
require_dependency 'environment' class Environment has_many :production_costs, class_name: 'ProductsPlugin::ProductionCost', as: :owner has_many :product_categories, class_name: 'ProductsPlugin::ProductCategory' has_many :products, through: :profiles has_many :qualifiers, class_name: 'ProductsPlugin::Qualifier' has_many :certifiers, class_name: 'ProductsPlugin::Certifier' has_many :units, -> { order 'position' }, class_name: 'ProductsPlugin::Unit' def highlighted_products_with_image(options = {}) self.products.where(highlighted: true).joins(:image).order('created_at ASC') end end |