Sha256: 5a8fc125aef1033e76126ac71a37eb084f510780000a1fedc530c41e2df23356
Contents?: true
Size: 938 Bytes
Versions: 2
Compression:
Stored size: 938 Bytes
Contents
module Plotline class Entry < ActiveRecord::Base include Plotline::Concerns::Searchable include Plotline::Concerns::Taggable include Plotline::Concerns::Family enum status: [ :draft, :published ] belongs_to :user scope :drafts, -> { where(status: :draft) } scope :published, -> { where(status: :published).where('published_at <= ?', Time.zone.now) } validates :title, presence: true validates :slug, uniqueness: { scope: :type, allow_blank: true } def self.content_attr(attr_name, attr_type = :string) content_attributes[attr_name] = attr_type define_method(attr_name) do self.payload ||= {} self.payload[attr_name.to_s] end define_method("#{attr_name}=".to_sym) do |value| self.payload ||= {} self.payload[attr_name.to_s] = value end end def self.content_attributes @content_attributes ||= {} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
plotline-0.1.1 | app/models/plotline/entry.rb |
plotline-0.1.0 | app/models/plotline/entry.rb |