Sha256: 1b514c6e2c350f1eb6c6d7ea4a38a39021ef113cf5d87a6e89e32bffd0ba248a

Contents?: true

Size: 432 Bytes

Versions: 6

Compression:

Stored size: 432 Bytes

Contents

module MechanizeStore
    class ProductSection < ActiveRecord::Base
        has_many :product_categories

        has_many :products, through: :product_categories

        after_create :create_slug
        before_update :set_defaults

        def set_defaults
          self.slug = self.name.parameterize
        end

        def create_slug
          self.update_attributes(:slug => self.name.parameterize)
        end
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mechanize_store-0.0.19 app/models/mechanize_store/product_section.rb
mechanize_store-0.0.18 app/models/mechanize_store/product_section.rb
mechanize_store-0.0.17 app/models/mechanize_store/product_section.rb
mechanize_store-0.0.16 app/models/mechanize_store/product_section.rb
mechanize_store-0.0.15 app/models/mechanize_store/product_section.rb
mechanize_store-0.0.14 app/models/mechanize_store/product_section.rb