Sha256: ecc2a8027094069c3b36ab35683ffecfb605103f2b4feca33961e55ce4c36687

Contents?: true

Size: 598 Bytes

Versions: 1

Compression:

Stored size: 598 Bytes

Contents

module Writefully
  class Post < ActiveRecord::Base
    extend FriendlyId
    include Writefully::Postable

    friendly_id :title, use: :slugged

    has_many :taggings
    wf_taxonomize :tags, -> { where(type: nil) }, through: :taggings

    belongs_to :authorship
    belongs_to :translation_source, class_name: "Writefully::Post"
    belongs_to :site

    has_many :translations, class_name: "Writefully::Post", foreign_key: :translation_source_id

    scope :by_site, -> (site_id) { where(site_id: site_id) }

    def details
      Hashie::Mash.new(read_attribute(:details))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
writefully-0.3.6 app/models/writefully/post.rb