Sha256: e1b96425f19442e2532cb88334843ed89e83dc2e50a51455f5601cb8846a0d56

Contents?: true

Size: 483 Bytes

Versions: 11

Compression:

Stored size: 483 Bytes

Contents

module MechanizeStore
    class Product < ActiveRecord::Base
        belongs_to :product_category, class_name: MechanizeStore::ProductCategory
        has_many :product_photos, class_name: MechanizeStore::ProductPhoto

        validates :name, :price, :description, :short_description, :weight, :length, :width, :height, presence: true

        def first_photo
            return nil if self.product_photos.empty?
            return self.product_photos.first
        end
    end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mechanize_store-0.0.17 app/models/mechanize_store/product.rb
mechanize_store-0.0.16 app/models/mechanize_store/product.rb
mechanize_store-0.0.15 app/models/mechanize_store/product.rb
mechanize_store-0.0.14 app/models/mechanize_store/product.rb
mechanize_store-0.0.13 app/models/mechanize_store/product.rb
mechanize_store-0.0.12 app/models/mechanize_store/product.rb
mechanize_store-0.0.11 app/models/mechanize_store/product.rb
mechanize_store-0.0.10 app/models/mechanize_store/product.rb
mechanize_store-0.0.8 app/models/mechanize_store/product.rb
mechanize_store-0.0.7 app/models/mechanize_store/product.rb
mechanize_store-0.0.6 app/models/mechanize_store/product.rb