Sha256: ecbd684aa859a6ca73e4b9a98e33eee4c8853aff7ab00d4f93b35eb10838a1ee

Contents?: true

Size: 387 Bytes

Versions: 63

Compression:

Stored size: 387 Bytes

Contents

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

    def type
      name.downcase.to_sym
    end

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

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
pulitzer-0.1.10 app/models/pulitzer/content_element_type.rb
pulitzer-0.1.9 app/models/pulitzer/content_element_type.rb
pulitzer-0.1.8 app/models/pulitzer/content_element_type.rb