Sha256: a7ddc568aace2b13851f905efd9fcf80e8b31ee5cae7318fa6098a2aaf923cb4

Contents?: true

Size: 770 Bytes

Versions: 21

Compression:

Stored size: 770 Bytes

Contents

module EveApp::ActivityRelation
  extend ActiveSupport::Concern

  included do
    belongs_to :type
    belongs_to :activity

    EveApp::Activity::TYPE_MAP.each do |id, type|
      scope type, -> { where(activity_id: id) }
    end
  end

  # included do
    # scope :invention, -> { where(activity_id: EveApp::Activity::INVENTION) }
    # scope :for, -> (tid, aid) { where(type_id: tid, activity_id: aid) }
    # ????
    # def activity_activity
    #   EveApp::Activity.where(type_id: type_id, activity_id: activity_id)
    # end
  # end

  # class_methods do
  #   def type_name
  #     reflections = self.reflect_on_all_associations(:belongs_to)
  #     reflections.select { |r| r.options[:class_name] == 'Type' && r.name != :type }.first.name
  #   end
  # end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
eve_app-0.1.34 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.33 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.32 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.31 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.29 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.27 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.22 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.21 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.20 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.19 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.18 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.17 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.16 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.14 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.13 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.12 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.11 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.10 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.9 app/models/concerns/eve_app/activity_relation.rb
eve_app-0.1.8 app/models/concerns/eve_app/activity_relation.rb