Sha256: 5cf1099a35c424dbb429c409f648da170c8686e4cefcbd0aa32d23f8b76fddef
Contents?: true
Size: 745 Bytes
Versions: 4
Compression:
Stored size: 745 Bytes
Contents
class Dorsale::Flyboy::TaskComment < ::Dorsale::ApplicationRecord self.table_name = "dorsale_flyboy_task_comments" belongs_to :task belongs_to :author, class_name: User 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
4 entries across 4 versions & 1 rubygems