Sha256: a9904e480e92a02b6328e57e3edb8b8fd65b3e14a7734a69cee86b7083fdb0df

Contents?: true

Size: 547 Bytes

Versions: 8

Compression:

Stored size: 547 Bytes

Contents

require "babosa"

module C80Catoffers
  class Category < ActiveRecord::Base

    has_many :child_categories, :class_name => 'Category', :foreign_key => 'parent_category_id'
    belongs_to :parent_category, :class_name => 'Category'
    has_and_belongs_to_many :offers

    extend FriendlyId
    friendly_id :title, use: :slugged
    def normalize_friendly_id(input)
      input.to_s.to_slug.normalize(transliterations: :russian).to_s
    end

    def slug_candidates
      [:title] + Array.new(6) {|index| [:title, index+2]}
    end
    
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
c80_catoffers-0.1.0.8 app/models/c80_catoffers/category.rb
c80_catoffers-0.1.0.7 app/models/c80_catoffers/category.rb
c80_catoffers-0.1.0.6 app/models/c80_catoffers/category.rb
c80_catoffers-0.1.0.5 app/models/c80_catoffers/category.rb
c80_catoffers-0.1.0.4 app/models/c80_catoffers/category.rb
c80_catoffers-0.1.0.3 app/models/c80_catoffers/category.rb
c80_catoffers-0.1.0.2 app/models/c80_catoffers/category.rb
c80_catoffers-0.1.0.1 app/models/c80_catoffers/category.rb