Sha256: 116ba8f7957cb3b65e14ddf8c6ac3499cae8cd537a24fd09405bed42fdca5ed8

Contents?: true

Size: 524 Bytes

Versions: 2

Compression:

Stored size: 524 Bytes

Contents

require 'babosa'

class C80Yax::Cat < ActiveRecord::Base

  validates :title,
            presence: true,
            uniqueness: true,
            length: { in: 6..50 }

  has_and_belongs_to_many :strsubcats

  extend FriendlyId
  friendly_id :slug_candidates, :use => :slugged

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

  def normalize_friendly_id(input)
    input.to_s.to_slug.normalize(transliterations: :russian).to_s
  end

  scope :menu_order, -> {order(:ord => :asc)}

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
c80_yax-0.1.0.3 app/models/c80_yax/cat.rb
c80_yax-0.1.0.2 app/models/c80_yax/cat.rb