Sha256: 7f861c2f303b52de59d45e52f1be26cf77a097a40a355aa8f680f2b658ed0bd2
Contents?: true
Size: 896 Bytes
Versions: 29
Compression:
Stored size: 896 Bytes
Contents
module Dorsale module Flyboy class TaskComment < ActiveRecord::Base 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 initialize(*args) super self.date = Time.now if date.nil? if progress.nil? self.progress = task ? task.progress : 0 end end after_create :update_task_progress def update_task_progress task.update_attributes!( :progress => progress, :done => progress.equal?(100) ) end end end end
Version data entries
29 entries across 29 versions & 1 rubygems