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.5.187 app/models/caboose/vendor.rb
caboose-cms-0.5.186 app/models/caboose/vendor.rb
caboose-cms-0.5.185 app/models/caboose/vendor.rb
caboose-cms-0.5.184 app/models/caboose/vendor.rb
caboose-cms-0.5.183 app/models/caboose/vendor.rb
caboose-cms-0.5.182 app/models/caboose/vendor.rb
caboose-cms-0.5.181 app/models/caboose/vendor.rb
caboose-cms-0.5.180 app/models/caboose/vendor.rb
caboose-cms-0.5.179 app/models/caboose/vendor.rb
caboose-cms-0.5.178 app/models/caboose/vendor.rb
caboose-cms-0.5.177 app/models/caboose/vendor.rb
caboose-cms-0.5.176 app/models/caboose/vendor.rb
caboose-cms-0.5.175 app/models/caboose/vendor.rb
caboose-cms-0.5.174 app/models/caboose/vendor.rb
caboose-cms-0.5.173 app/models/caboose/vendor.rb
caboose-cms-0.5.172 app/models/caboose/vendor.rb
caboose-cms-0.5.171 app/models/caboose/vendor.rb
caboose-cms-0.5.170 app/models/caboose/vendor.rb
caboose-cms-0.5.169 app/models/caboose/vendor.rb
caboose-cms-0.5.168 app/models/caboose/vendor.rb