Sha256: 46c790229570cd1d75a77dba4c267c0bf041eafa394a8ab5d8ef0db7ee799c8a
Contents?: true
Size: 746 Bytes
Versions: 8
Compression:
Stored size: 746 Bytes
Contents
class Dorsale::Flyboy::TaskComment < ::Dorsale::ApplicationRecord self.table_name = "dorsale_flyboy_task_comments" belongs_to :task belongs_to :author, polymorphic: true validates :author, presence: true validates :task, presence: true validates :date, presence: true validates :description, presence: true validates :progress, inclusion: {in: 0..100} default_scope -> { order("created_at DESC") } def assign_default_values assign_default :date, Time.zone.now assign_default :progress, (task ? task.progress : 0) end after_create :update_task_progress def update_task_progress task.update!( :progress => progress, :done => progress.equal?(100) ) end end
Version data entries
8 entries across 8 versions & 1 rubygems