Class: InstantRecord::MutationsController
- Inherits:
-
ActionController::API
- Object
- ActionController::API
- InstantRecord::MutationsController
- Defined in:
- app/controllers/instant_record/mutations_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
Accepts a batch of client mutations; MutationApplier owns the sync semantics (idempotency, LWW, versioning, change logging).
- #preflight ⇒ Object
Instance Method Details
#create ⇒ Object
Accepts a batch of client mutations; MutationApplier owns the sync semantics (idempotency, LWW, versioning, change logging).
11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/instant_record/mutations_controller.rb', line 11 def create results = Array(params.require(:mutations)).map do |raw| MutationApplier.apply( raw.permit(:id, :record_type, :record_id, :operation, :base_version, changes: {}) ) end render json: { results: results } end |
#preflight ⇒ Object
5 6 7 |
# File 'app/controllers/instant_record/mutations_controller.rb', line 5 def preflight head :no_content end |