Sha256: 78c6a5c9dfb376ab1a2bc00d8c3441ea92e63b2f9e139bf82ff120ef7d0201bd

Contents?: true

Size: 538 Bytes

Versions: 9

Compression:

Stored size: 538 Bytes

Contents

class VendorCategory < ActiveRecord::Base
  include E9Vendors::Model

  has_and_belongs_to_many :vendors

  validates :name, :presence => true

  scope :widget_visible, lambda {
    joins(:vendors => :vendor_proxies).group('vendor_categories.id') & VendorProxy.widget_visible
  }

  scope :ordered, lambda { order(:position) }

  # On updates, all members are touched, ensuring that widget JSON requests 
  # for the associations are pulling the most recent information
  after_save :on => :update do
    VendorMember.touch_all
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
e9_vendors-0.0.10 app/models/vendor_category.rb
e9_vendors-0.0.9 app/models/vendor_category.rb
e9_vendors-0.0.8 app/models/vendor_category.rb
e9_vendors-0.0.7 app/models/vendor_category.rb
e9_vendors-0.0.6 app/models/vendor_category.rb
e9_vendors-0.0.5 app/models/vendor_category.rb
e9_vendors-0.0.4 app/models/vendor_category.rb
e9_vendors-0.0.3 app/models/vendor_category.rb
e9_vendors-0.0.2 app/models/vendor_category.rb