Class: Moon::Action::Model::Store
- Inherits:
-
Object
- Object
- Moon::Action::Model::Store
- Defined in:
- lib/moon/action/model/store.rb
Overview
Generic model update action. Stores the specified model to the storage.
Instance Method Summary collapse
-
#initialize(model_symbol) ⇒ Store
constructor
A new instance of Store.
- #perform(context) ⇒ Object
Constructor Details
#initialize(model_symbol) ⇒ Store
Returns a new instance of Store.
5 6 7 |
# File 'lib/moon/action/model/store.rb', line 5 def initialize(model_symbol) @model_symbol = model_symbol end |
Instance Method Details
#perform(context) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/moon/action/model/store.rb', line 9 def perform(context) model = context.models[@model_symbol] if model storage_name = GOM::Object.storage_name(model) || context.application.storage_name GOM::Storage.store model, storage_name nil else Moon::Response::JSON::Message.new 200, "No model initialized." end end |