Sha256: c36fb24f43b771f174297bb9a95655f854dc49921e97e78b3c12471dbb3208d4

Contents?: true

Size: 614 Bytes

Versions: 12

Compression:

Stored size: 614 Bytes

Contents

module Ucpengine
  class Entry < ActiveRecord::Base
    scope :published, -> { where('published_at <= ?', Time.zone.now) }
    include Ucpengine::Concerns::Searchable
    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

12 entries across 12 versions & 1 rubygems

Version Path
ucpengine-0.1.2 app/models/ucpengine/entry.rb
ucpengine-0.1.1 app/models/ucpengine/entry.rb
ucpengine-0.1.0 app/models/ucpengine/entry.rb
ucpengine-0.0.9 app/models/ucpengine/entry.rb
ucpengine-0.0.8 app/models/ucpengine/entry.rb
ucpengine-0.0.7 app/models/ucpengine/entry.rb
ucpengine-0.0.6 app/models/ucpengine/entry.rb
ucpengine-0.0.5 app/models/ucpengine/entry.rb
ucpengine-0.0.4 app/models/ucpengine/entry.rb
ucpengine-0.0.3 app/models/ucpengine/entry.rb
ucpengine-0.0.2 app/models/ucpengine/entry.rb
ucpengine-0.0.1 app/models/ucpengine/entry.rb