Sha256: e722452f0aa7fbc0ab36d62cf9d0af8e6526265a1b8b656a99df52b271148905

Contents?: true

Size: 865 Bytes

Versions: 191

Compression:

Stored size: 865 Bytes

Contents

module Caboose
  class Vendor < ActiveRecord::Base
    self.table_name = 'store_vendors'

    belongs_to :site    
    has_many :products
    has_attached_file :image, 
      :path => ':path_prefixvendors/:id_:style.:extension',    
      :default_url => 'http://placehold.it/300x300',    
      :styles => {
        :tiny  => '150x200>',
        :thumb => '300x400>',
        :large => '600x800>'
      }
    do_not_validate_attachment_file_type :image
    attr_accessible :id,    
      :site_id,
      :alternate_id,
      :name, 
      :status,
      :sort_order
    after_save :clear_filters

    def self.active
      where(:status => 'Active')
    end
    
    def update_products
      self.products.each { |product| product.update_attribute(:vendor_status, self.status) }
    end
    
    def clear_filters
      SearchFilter.delete_all
    end
  end
end

Version data entries

191 entries across 191 versions & 1 rubygems

Version Path
caboose-cms-0.6.9 app/models/caboose/vendor.rb
caboose-cms-0.6.8 app/models/caboose/vendor.rb
caboose-cms-0.6.7 app/models/caboose/vendor.rb
caboose-cms-0.6.6 app/models/caboose/vendor.rb
caboose-cms-0.6.5 app/models/caboose/vendor.rb
caboose-cms-0.6.4 app/models/caboose/vendor.rb
caboose-cms-0.6.3 app/models/caboose/vendor.rb
caboose-cms-0.6.2 app/models/caboose/vendor.rb
caboose-cms-0.6.1 app/models/caboose/vendor.rb
caboose-cms-0.5.238 app/models/caboose/vendor.rb
caboose-cms-0.5.237 app/models/caboose/vendor.rb
caboose-cms-0.5.236 app/models/caboose/vendor.rb
caboose-cms-0.5.235 app/models/caboose/vendor.rb
caboose-cms-0.5.234 app/models/caboose/vendor.rb
caboose-cms-0.5.233 app/models/caboose/vendor.rb
caboose-cms-0.5.232 app/models/caboose/vendor.rb
caboose-cms-0.5.231 app/models/caboose/vendor.rb
caboose-cms-0.5.230 app/models/caboose/vendor.rb
caboose-cms-0.5.229 app/models/caboose/vendor.rb
caboose-cms-0.5.228 app/models/caboose/vendor.rb