Method: Invoicing::TimeDependent::ClassMethods#default_record_at
- Defined in:
- lib/invoicing/time_dependent.rb
#default_record_at(point_in_time) ⇒ Object
Returns the default record which is valid at a particular point in time. If there is no record marked as default, nil is returned; if there are multiple records marked as default, results are undefined. This method only works if the model objects have an is_default column.
267 268 269 270 |
# File 'lib/invoicing/time_dependent.rb', line 267 def default_record_at(point_in_time) info = time_dependent_class_info valid_records_at(point_in_time).select{|record| info.get(record, :is_default)}.first end |