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