Sha256: 42526c53163e0362f53d24030d3c5d9255ce35ad06256fd577e16fb861015bbc
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true # This responder modifies your current responder to redirect # to the collection page on POST/PUT/DELETE if you use save, not for 'continue'. module Auxilium module ContinueResponder protected def navigation_location return options[:location] if options[:location] && (controller.is_a?(Devise::SessionsController) || controller.is_a?(Devise::PasswordsController)) return options[:location] if controller.params[:commit] == 'continue' && options[:location] return options[:collection_location].call if %w[save commit].include?(controller.params[:commit]) && options[:collection_location] return resource_location if controller.params[:commit] == 'continue' klass = resources.last.class if klass.respond_to?(:model_name) resources[0...-1] << klass.model_name.route_key.to_sym else resources end end def navigation_behavior(error) if get? raise error elsif has_errors? && options[:error_location] redirect_to options[:error_location].call, status: :see_other elsif has_errors? && default_action render error_rendering_options else redirect_to navigation_location, status: :see_other end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
auxilium-3.0.24 | lib/auxilium/responders/continue_responder.rb |