Sha256: 642a5e3bde9f3fc2fbe3ca584717f06d27a1eb3744520dae0746fd18a2bc3a04

Contents?: true

Size: 706 Bytes

Versions: 3

Compression:

Stored size: 706 Bytes

Contents

module Zertico
  module Responder
    def initialize(controller, resources, options={})
      super
      @force_redirect = options.delete(:force_redirect)
    end

    protected

    def navigation_behavior(error)
      if get?
        raise error
      elsif has_errors? && default_action
        if @force_redirect
          controller.flash.keep
          redirect_to navigation_location
        else
          controller.flash.clear
          render :action => default_action
        end
      else
        controller.flash.keep
        redirect_to navigation_location
      end
    end

    def set_flash_message?
      return @force_redirect unless @force_redirect.nil?
      super
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zertico-1.1.1 lib/zertico/responder.rb
zertico-1.1.0 lib/zertico/responder.rb
zertico-1.0.0 lib/zertico/responder.rb