Class: Fasta::Server::Actions::Put
- Inherits:
-
Core::Write
- Object
- Core::Responder
- Core::Write
- Fasta::Server::Actions::Put
- Defined in:
- lib/fasta/server/actions/put.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Core::Responder
Instance Attribute Summary
Attributes inherited from Core::Responder
Instance Method Summary collapse
Methods inherited from Core::Write
Methods inherited from Core::Responder
#body, call, #call, #db_table, #db_table_name, #initialize, #response_code, #to_rack_array, validate_fields
Constructor Details
This class inherits a constructor from Fasta::Server::Core::Responder
Instance Method Details
#default_response_code ⇒ Object
7 8 9 |
# File 'lib/fasta/server/actions/put.rb', line 7 def default_response_code 201 end |
#success ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/fasta/server/actions/put.rb', line 11 def success if instance = db_table.where(id: params[:id]) instance.update(params.merge(default_updated_at)) @response_code = 204 nil else db_table.insert(params.merge(default_attributes)) end end |