I am using rails 5.0.2 with virtus 1.0.5. I have a form defined as below
class MyForm
include Virtus.model
attribute :age, Integer, default: 0
attribute :birthday, DateTime, default: :some_date
attribute :salutation, String, default: 'Mr.'
def initialize
end
private
def some_date
Date.today - 3.years
end
end
If the initialize method is removed, the default values are present when an instance of MyForm is created. The values are absent if the initialize is present.