Class: Moon::Action::InjectTimestamps
- Inherits:
-
Object
- Object
- Moon::Action::InjectTimestamps
- Defined in:
- lib/moon/action/inject_timestamps.rb
Instance Method Summary collapse
-
#initialize(model_key) ⇒ InjectTimestamps
constructor
A new instance of InjectTimestamps.
- #perform(context) ⇒ Object
Constructor Details
#initialize(model_key) ⇒ InjectTimestamps
Returns a new instance of InjectTimestamps.
4 5 6 |
# File 'lib/moon/action/inject_timestamps.rb', line 4 def initialize(model_key) @model_key = model_key end |
Instance Method Details
#perform(context) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/moon/action/inject_timestamps.rb', line 8 def perform(context) @context = context fetch_model fetch_id fetch_now inject_created_at unless has_id? inject_update_at nil end |