Been following Rails Testing Prescriptions. The Task
table has a column named completed_at
. Why can I only write to it with self.completed_at = date
(completed_at = date
fails) but I can access the attribute without self
in the complete?
method?
class Task < ApplicationRecord
belongs_to :project
def mark_completed(date = Time.current)
self.completed_at = date
end
def complete?
completed_at.present?
end
end
Thanks in advance