Class: RandomizedField::Callback
- Inherits:
-
Object
- Object
- RandomizedField::Callback
- Defined in:
- lib/randomized_field/callback.rb
Overview
Implements the before_create ActiveRecord callback used to set the value of the randomized field.
Instance Method Summary collapse
- #before_create(record) ⇒ Object
-
#initialize(field_name, **generator_opts, &block) ⇒ Callback
constructor
A new instance of Callback.
Constructor Details
Instance Method Details
#before_create(record) ⇒ Object
13 14 15 |
# File 'lib/randomized_field/callback.rb', line 13 def before_create(record) record[field_name] ||= new_field_value(record) end |