Class: Moon::Action::Reference
- Inherits:
-
Object
- Object
- Moon::Action::Reference
- Defined in:
- lib/moon/action/reference.rb
Overview
The action creates a reference to the given store object and stores it in the given model attribute.
Instance Method Summary collapse
-
#initialize(options) ⇒ Reference
constructor
A new instance of Reference.
- #perform(context) ⇒ Object
Constructor Details
#initialize(options) ⇒ Reference
Returns a new instance of Reference.
5 6 7 8 9 |
# File 'lib/moon/action/reference.rb', line 5 def initialize() from, to = .values_at :from, :to @store_method, @store_key = from @model_key, @model_attribute = to end |
Instance Method Details
#perform(context) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/moon/action/reference.rb', line 11 def perform(context) @context = context fetch_object create_reference store_reference nil end |