class ImportController < ApplicationController map_fields :create, ['Title', 'First name', 'Last name', 'Email'], :file_field => 'file', :params => [:name] def new render end def create begin if fields_mapped? #Process import render :done else render end rescue MapFields::InconsistentStateError logger.debug 'catching InconsistentStateError' redirect_to :action => :new, :status => 303 return rescue MapFields::MissingFileContentsError logger.debug 'catching MissingFileContentsError' flash[:error] = 'Please upload a file' render :action => :new return end logger.debug 'here' end end