Closed palexander closed 11 years ago
:+1:
The way it has been implemented is:
attribute :created, :date_time_xsd => true, :single_value=> true, :default => lambda { |record| DateTime.now }
if needed the record
is passed to the lambda in case one needs to access any attributes to set the default value.
Would be cool to have an option to have date fields populated on save or instantiation. Here's what I imagine:
This would save a lot of boilerplate code. In ActiveRecord you get the "created" and "updated" fields for every object unless you specify otherwise.
:+1: