app/models/flyboy/task_comment.rb in flyboy-0.0.5 vs app/models/flyboy/task_comment.rb in flyboy-0.0.6
- old
+ new
@@ -6,9 +6,14 @@
validates :date, 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?
+ end
+
after_create :update_task_progress
def update_task_progress
task.update_attributes(
:progress => progress,