Skip to content

Instantly share code, notes, and snippets.

View cjcolvar's full-sized avatar

Chris Colvard cjcolvar

  • Bloomington, IN
View GitHub Profile
@cjcolvar
cjcolvar / controller
Last active December 18, 2015 02:08
Batch delete example working with cancan's load_and_authorize_resource
class RolesController < ApplicationController
include Hydra::RoleManagement::RolesBehavior
prepend_before_filter :accept_batches, only: [:destroy]
def destroy
@roles.each {|role| role.destroy}
redirect_to roles_path, notice: "Successfully deleted groups: #{params[:ids].join(", ")}"
end
@mbklein
mbklein / restart_masterfile.rb
Last active August 29, 2015 14:04
How to restart a hung MasterFile in Matterhorn
empty = ActiveFedora::SimpleDatastream.xml_template.to_xml
mf = MasterFile.find(pid) # Load the MasterFile.
if mf.workflow_id.present?
begin
Rubyhorn.client.stop(mf.workflow_id) # Stop the existing workflow.
rescue # Keep going even if stopping the workflow fails.
end # This means there might be more cleanup later.
end
mf.mhMetadata.content = empty # Remove all Matterhorn-related fields.