Class: SupplejackApi::Harvester::FragmentsController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- SupplejackApi::Harvester::FragmentsController
- Defined in:
- app/controllers/supplejack_api/harvester/fragments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/controllers/supplejack_api/harvester/fragments_controller.rb', line 14 def create klass = params[:preview] ? PreviewRecord : Record @record = klass.find(params[:record_id]) @record.create_or_update_fragment(params[:fragment]) @record.set_status(params[:required_fragments]) @record.save render json: { record_id: @record.record_id } end |
#destroy ⇒ Object
23 24 25 26 27 |
# File 'app/controllers/supplejack_api/harvester/fragments_controller.rb', line 23 def destroy SupplejackApi::Record.where("fragments.source_id": params[:id]) .update_all('$pull' => { fragments: { source_id: params[:id] } }) respond_with end |