Skip to content

Instantly share code, notes, and snippets.

cjcolvar

Block or report user

Report or block cjcolvar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mbklein
mbklein / restart_masterfile.rb
Last active Aug 29, 2015
How to restart a hung MasterFile in Matterhorn
View restart_masterfile.rb
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.
@cjcolvar
cjcolvar / controller
Last active Dec 18, 2015
Batch delete example working with cancan's load_and_authorize_resource
View controller
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
You can’t perform that action at this time.