Sha256: 6445e362ec0765d62e0d719bac9e018a6fa115807470ede279bee53bfc4f4718

Contents?: true

Size: 513 Bytes

Versions: 5

Compression:

Stored size: 513 Bytes

Contents

# frozen_string_literal: true
module SocialNetworking
  # An item that a Participant has shared.
  class SharedItem < ActiveRecord::Base
    before_save :default_creator, :set_action_type

    belongs_to :item, polymorphic: true
    has_many :comments, as: "item"
    has_many :likes, as: "item"
    belongs_to :participant

    private

    def default_creator
      self.participant_id = item.participant_id
    end

    def set_action_type
      self.action_type = Shareable.new(item).action
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
social_networking-0.13.3 app/models/social_networking/shared_item.rb
social_networking-0.13.2 app/models/social_networking/shared_item.rb
social_networking-0.13.1 app/models/social_networking/shared_item.rb
social_networking-0.13.0 app/models/social_networking/shared_item.rb
social_networking-0.12.0 app/models/social_networking/shared_item.rb