Sha256: df4510563dd7c42bdf0ec52804df9b9343fe7134f53e8126ddfe3f06ac448cf2
Contents?: true
Size: 702 Bytes
Versions: 1
Compression:
Stored size: 702 Bytes
Contents
module Tasks::Concerns::Models::Task extend ActiveSupport::Concern included do belongs_to :taskable, polymorphic: true has_many :responses, class_name: '::Tasks::Taskables::Taskable::Response' scope :completed_by, ->(author) do joins(:responses).where( "tasks_taskables_taskable_responses.author_id = ? and tasks_taskables_taskable_responses.author_type = ?", author.id, author.class.name ).uniq end scope :incomplete_by, ->(author) { all.reject { |task| task.completed_by? author }} validates :taskable, presence: true delegate :completed_by?, :submissions, to: :taskable def to_s taskable.to_s end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tasuku-0.0.1 | lib/tasks/concerns/models/task.rb |