Sha256: 68839b652a85528bc2acb42521e6110ee20def6a372b0b418fd300fe2929a6a3

Contents?: true

Size: 530 Bytes

Versions: 1

Compression:

Stored size: 530 Bytes

Contents

module Feeder::Concerns::Feedable
  extend ActiveSupport::Concern

  included do
    attr_accessor :sticky

    has_one :feeder_item, as: :feedable, class_name: 'Feeder::Item', dependent: :destroy

    def sticky
      if feeder_item
        feeder_item.sticky
      else
        !!@sticky
      end
    end

    def sticky= value
      @sticky = value

      if feeder_item
        feeder_item.sticky = value
      end
    end

    delegate :block, :unblock, :blocked?, :report, :unreport, :reported?, to: :feeder_item
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
feeder-0.5.1 lib/feeder/concerns/feedable.rb