diff --git a/lib/avalon/workflow/workflow_controller_behavior.rb b/lib/avalon/workflow/workflow_controller_behavior.rb index c15bbbb..b760297 100644 --- a/lib/avalon/workflow/workflow_controller_behavior.rb +++ b/lib/avalon/workflow/workflow_controller_behavior.rb @@ -67,15 +67,14 @@ def update respond_to do |format| format.html do - flash[:error] = context[:error] - flash[:notice] = context[:notice] + flashes = { error: context[:error], notice: context[:notice]} if model_object.errors.present? flash[:error] = 'There are errors with your submission. Please correct them before continuing.' render :edit elsif model_object.workflow.published? && model_object.workflow.current?(@active_step) - redirect_to(polymorphic_path(model_object), flash: flash) + redirect_to(polymorphic_path(model_object), flash: flashes) else - redirect_to(get_redirect_path(@active_step, model_object), flash: flash) + redirect_to(get_redirect_path(@active_step, model_object), flash: flashes) end end end diff --git a/lib/avalon/workflow/workflow_datastream.rb b/lib/avalon/workflow/workflow_datastream.rb index 215411c..7bf5be4 100644 --- a/lib/avalon/workflow/workflow_datastream.rb +++ b/lib/avalon/workflow/workflow_datastream.rb @@ -35,7 +35,7 @@ def published= publication_status def last_completed_step= active_step active_step = active_step.first if active_step.is_a? Array unless HYDRANT_STEPS.exists? active_step - logger.warn "Unrecognized step : #{active_step}" + Rails.logger.warn "Unrecognized step : #{active_step}" end # Set it anyways for now. Need to come up with a more robust warning @@ -45,7 +45,7 @@ def last_completed_step= active_step def origin= source unless ['batch', 'web', 'console'].include? source - logger.warn "Unrecognized origin : #{source}" + Rails.logger.warn "Unrecognized origin : #{source}" update_values({[{:origin=>"0"}]=>{"0"=>"unknown"}}) else update_values({[{:origin=>"0"}]=>{"0"=>source}}) @@ -99,11 +99,11 @@ def advance lcs = (last_completed_step.is_a? Array) ? last_completed_step.first : last_completed_step if (lcs.blank? or not HYDRANT_STEPS.exists?(lcs)) - logger.warn "<< Step #{lcs} invalid, defaulting to first step >>" + Rails.logger.warn "<< Step #{lcs} invalid, defaulting to first step >>" self.last_completed_step = HYDRANT_STEPS.first.step elsif (not HYDRANT_STEPS.last?(lcs)) next_step = HYDRANT_STEPS.next(lcs).step - logger.debug "<< Advancing to the next step - #{next_step} >>" + Rails.logger.debug "<< Advancing to the next step - #{next_step} >>" self.last_completed_step = next_step end end @@ -114,9 +114,9 @@ def publish end def update_status(active_step=nil) - logger.debug "<< UPDATE_INGEST_STATUS >>" + Rails.logger.debug "<< UPDATE_INGEST_STATUS >>" active_step = active_step || last_completed_step.first - logger.debug "<< COMPLETED : #{completed?(active_step)} >>" + Rails.logger.debug "<< COMPLETED : #{completed?(active_step)} >>" if current?(active_step) and not published? advance @@ -125,7 +125,7 @@ def update_status(active_step=nil) if HYDRANT_STEPS.last? active_step and completed? active_step publish end - logger.debug "<< PUBLISHED : #{published?} >>" + Rails.logger.debug "<< PUBLISHED : #{published?} >>" end def self.xml_template @@ -140,12 +140,8 @@ def self.xml_template builder.doc end - def prefix - "" - end - - def to_solr(solr_doc=SolrDocument.new) - super(solr_doc) + def to_solr(solr_doc=Hash.new, opts = {}) + super(solr_doc, opts) solr_value = case last_completed_step.first when blank? @@ -165,16 +161,16 @@ def to_solr(solr_doc=SolrDocument.new) protected def reset_values - logger.debug "<< BEFORE_SAVE (IngestStatus) >>" - logger.debug "<< last_completed_step => #{last_completed_step} >>" + Rails.logger.debug "<< BEFORE_SAVE (IngestStatus) >>" + Rails.logger.debug "<< last_completed_step => #{last_completed_step} >>" if published.nil? - logger.debug "<< Default published flag = false >>" + Rails.logger.debug "<< Default published flag = false >>" published = false end if last_completed_step.nil? - logger.debug "<< Default step = #{HYDRANT_STEPS.first.step} >>" + Rails.logger.debug "<< Default step = #{HYDRANT_STEPS.first.step} >>" last_completed_step = HYDRANT_STEPS.first.step end end diff --git a/lib/avalon/workflow/workflow_model_mixin.rb b/lib/avalon/workflow/workflow_model_mixin.rb index 2f5fa1e..ecdbedd 100644 --- a/lib/avalon/workflow/workflow_model_mixin.rb +++ b/lib/avalon/workflow/workflow_model_mixin.rb @@ -18,7 +18,7 @@ module Avalon::Workflow module WorkflowModelMixin def self.included(klazz) - klazz.has_metadata name: 'workflow', type: WorkflowDatastream + klazz.has_subresource 'workflow', class_name: 'WorkflowDatastream' end end end