Sha256: 04aa008fda8b259909a3500c0187ca2e10b57b36228e4e067e041eefbc7c5790

Contents?: true

Size: 502 Bytes

Versions: 18

Compression:

Stored size: 502 Bytes

Contents

module Pulitzer
  class ContentElementType < ActiveRecord::Base
    validates :name, presence: true, uniqueness: true
    has_many :post_type_content_element_types, dependent: :destroy
    has_many :layouts, dependent: :destroy

    def type
      name.downcase.to_sym
    end

    %i(text image video clickable).each do |content_type|
      define_method "#{content_type}_type?" do
        type == content_type
      end
    end

    def has_styles?
      [:clickable].include? type
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
pulitzer-0.15.12 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.11 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.10 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.9 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.8 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.7 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.6 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.5 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.4 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.3 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.2 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.1 app/models/pulitzer/content_element_type.rb
pulitzer-0.15.0 app/models/pulitzer/content_element_type.rb
pulitzer-0.14.4 app/models/pulitzer/content_element_type.rb
pulitzer-0.14.3 app/models/pulitzer/content_element_type.rb
pulitzer-0.14.2 app/models/pulitzer/content_element_type.rb
pulitzer-0.14.1 app/models/pulitzer/content_element_type.rb
pulitzer-0.14.0 app/models/pulitzer/content_element_type.rb