Sha256: c9a5cf604520d4e593616c92068f73877283ceef2fe9fc6fc92c839b92b78c59

Contents?: true

Size: 442 Bytes

Versions: 3

Compression:

Stored size: 442 Bytes

Contents

class Cms::Tag < ActiveRecord::Base
  unloadable

  set_table_name 'cms_tags'

  class << self
    def find_or_initialize_with_name_like(name)
      with_name_like(name).first || new(:name => name)
    end
  end

  has_many :taggings, :dependent => :destroy, :class_name => 'Cms::Tagging'

  validates_presence_of :name

  named_scope :with_name_like, lambda { |name| { :conditions => ["name like ?", name] } }

  def to_s
    name
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
liquid_cms-0.2.2.0 app/models/cms/tag.rb
liquid_cms-0.2.1.1 app/models/cms/tag.rb
liquid_cms-0.2.1.0 app/models/cms/tag.rb