Sha256: c49ae59c8cddeb0d16fc31999e2b9268ecd41352ad73508e62c1f587bfafb976
Contents?: true
Size: 706 Bytes
Versions: 4
Compression:
Stored size: 706 Bytes
Contents
module Tasuku::Concerns::Models::Task extend ActiveSupport::Concern included do belongs_to :taskable, polymorphic: true has_many :responses, class_name: '::Tasuku::Taskables::Taskable::Response' scope :completed_by, ->(author) do joins(:responses).where( "tasuku_taskables_taskable_responses.author_id = ? and tasuku_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
4 entries across 4 versions & 1 rubygems