app/controllers/granules_controller.rb
# Pulls in the latest granule revision and associates it with the collection
# using the specified "granule id."
Pulls in the latest granule revision and associates it with the collection
using the specified "granule id."
Pulls in the latest granule revision and associates it with the collection using the specified " granule id . "
def pull_latest
    granule = Granule.find(params[:id])
    collection = granule.collection
    begin
      Granule.add_new_revision_to_granule(granule, current_user)
      flash[:notice] = "A new granule revision has been added for this collection."
      redirect_to collection_path(id: 1, record_id: collection.records.first.id)
    rescue ActiveRecord::ActiveRecordError => e
      flash[:notice] = 'Sorry, Error occurred creating a new granule review.'
      Rails.logger.error("Sorry, Error occurred creating a new granule review.  error=#{e.message}")
      redirect_to collection_path(id: 1, record_id: collection.records.first.id)
    rescue Cmr::CmrError => e
      flash[:notice] = 'Sorry, Error occurred retrieving granule metadata from CMR.'
      Rails.logger.error("Sorry, Error occurred retrieving granule metadata from CMR.  error=#{e.message}")
      redirect_to collection_path(id: 1, record_id: collection.records.first.id)
    end
  end
def pull_latest granule = Granule . find ( params [ :id ] ) collection = granule . collection begin Granule . add_new_revision_to_granule ( granule , current_user ) flash [ :notice ] = "A new granule revision has been added for this collection." redirect_to collection_path ( id : 1 , record_id : collection . records . first . id ) rescue ActiveRecord :: ActiveRecordError => e flash [ :notice ] = 'Sorry, Error occurred creating a new granule review.' Rails . logger . error ( "Sorry, Error occurred creating a new granule review.  error=#{e.message}" ) redirect_to collection_path ( id : 1 , record_id : collection . records . first . id ) rescue Cmr :: CmrError => e flash [ :notice ] = 'Sorry, Error occurred retrieving granule metadata from CMR.' Rails . logger . error ( "Sorry, Error occurred retrieving granule metadata from CMR.  error=#{e.message}" ) redirect_to collection_path ( id : 1 , record_id : collection . records . first . id ) end end
Pulls in the latest granule revision and associates it with the collection
using the specified "granule id."
Pulls in the latest granule revision and associates it with the collection using the specified " granule id . "