Sha256: 15281801dcc748f98f3306fdc29cd24882462042bcc16e62493628d217bf7425
Contents?: true
Size: 681 Bytes
Versions: 16
Compression:
Stored size: 681 Bytes
Contents
class Pulitzer::PostType < ActiveRecord::Base enum kind: [ :template, :free_form, :hybrid ] has_many :posts, dependent: :destroy has_many :post_type_content_element_types, dependent: :destroy has_many :content_element_types, through: :post_type_content_element_types validates :name, :kind, presence: true validates :plural, :inclusion => { :in => [true, false] } def self.named(label) self.find_by(name: label) end def singular? !plural end def singleton_post posts.first end def singleton_post? !!singleton_post end def allow_template? template? || hybrid? end def allow_free_form? free_form? || hybrid? end end
Version data entries
16 entries across 16 versions & 1 rubygems