Module: Inkwell::ActsAsInkwellPost::Config

Defined in:
lib/acts_as_inkwell_post/base.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_inkwell_postObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/acts_as_inkwell_post/base.rb', line 12

def acts_as_inkwell_post
  attr_accessor :is_reblogged
  attr_accessor :is_favorited
  attr_accessor :item_id_in_line
  attr_accessor :is_reblog_in_blogline
  attr_accessor :from_sources_in_timeline

  has_many :blog_items, -> { where item_type: ::Inkwell::Constants::ItemTypes::POST}, :class_name => 'Inkwell::BlogItem', :foreign_key => :item_id
  if ::Inkwell::Engine::config.respond_to?('community_table')
    has_many ::Inkwell::Engine::config.community_table, -> {where "inkwell_blog_items.owner_type" => ::Inkwell::Constants::OwnerTypes::COMMUNITY}, :class_name => ::Inkwell::Engine::config.community_table.to_s.singularize.capitalize, :through => :blog_items
  end

  after_create :processing_a_post
  before_destroy :destroy_post_processing

  include ::Inkwell::ActsAsInkwellPost::InstanceMethods

end