Module: Sequel::Plugins::DefaultsSetter::InstanceMethods
- Defined in:
- lib/sequel/plugins/defaults_setter.rb
Instance Method Summary collapse
-
#[](k) ⇒ Object
Use default value for a new record if values doesn’t already contain an entry for it.
Instance Method Details
#[](k) ⇒ Object
Use default value for a new record if values doesn’t already contain an entry for it.
58 59 60 61 62 63 64 65 |
# File 'lib/sequel/plugins/defaults_setter.rb', line 58 def [](k) if new? && !values.has_key?(k) v = model.default_values[k] v.respond_to?(:call) ? v.call : v else super end end |