Method: CurationConcerns::FileSetsControllerBehavior#update

Defined in:
app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb

#updateObject

routed to /files/:id (PUT)



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb', line 80

def update
  success = if wants_to_revert?
              actor.revert_content(params[:revision])
            elsif params.key?(:file_set)
              if params[:file_set].key?(:files)
                actor.update_content(params[:file_set][:files].first)
              else
                
              end
            end
  if success
    after_update_response
  else
    respond_to do |wants|
      wants.html do
        initialize_edit_form
        flash[:error] = "There was a problem processing your request."
        render 'edit', status: :unprocessable_entity
      end
      wants.json { render_json_response(response_type: :unprocessable_entity, options: { errors: curation_concern.errors }) }
    end
  end
rescue RSolr::Error::Http => error
  flash[:error] = error.message
  logger.error "FileSetsController::update rescued #{error.class}\n\t#{error.message}\n #{error.backtrace.join("\n")}\n\n"
  render action: 'edit'
end