Class: RestPack::Service::Commands::Create

Inherits:
RestPack::Service::Command show all
Defined in:
lib/restpack_service/commands/create.rb

Instance Attribute Summary

Attributes inherited from RestPack::Service::Command

#response

Instance Method Summary collapse

Methods inherited from RestPack::Service::Command

#Model, #Serializer, #field_error, inherited, #init, #run, #service_error, #status, #valid?

Instance Method Details

#executeObject



5
6
7
8
# File 'lib/restpack_service/commands/create.rb', line 5

def execute
  models = self.class.model_class.create!(inputs[self.class.serializer_class.key])
  self.class.serializer_class.serialize models
end