Sha256: 3863b1bd2a8089427255f3c0ac38bf48de5ecfbff32ab362dbc44246178b2d3a

Contents?: true

Size: 687 Bytes

Versions: 13

Compression:

Stored size: 687 Bytes

Contents

# frozen_string_literal: true

module MaintenanceStandards
  # Informs the user and redirects when needed
  #
  # @param result [Boolean] was update or create succesful
  # @param path [URL] where to redirect to
  # @param notice [String] What to show on success
  # @param error [String] What to show on error
  # @param render_action [Symbol] What to render
  #
  def flash_and_redirect(result, path, notice, error, render_action = :edit)
    if result
      if params[:commit] == "continue"
        flash.now[:notice] = notice
      else
        redirect_to(path, notice: notice) && return
      end
    else
      flash.now[:error] = error
    end
    render render_action
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
importo-3.0.21 app/controllers/concerns/maintenance_standards.rb
importo-3.0.20 app/controllers/concerns/maintenance_standards.rb
importo-3.0.19 app/controllers/concerns/maintenance_standards.rb
importo-3.0.18 app/controllers/concerns/maintenance_standards.rb
importo-3.0.17 app/controllers/concerns/maintenance_standards.rb
importo-3.0.16 app/controllers/concerns/maintenance_standards.rb
importo-3.0.15 app/controllers/concerns/maintenance_standards.rb
importo-3.0.14 app/controllers/concerns/maintenance_standards.rb
importo-3.0.13 app/controllers/concerns/maintenance_standards.rb
importo-3.0.12 app/controllers/concerns/maintenance_standards.rb
importo-3.0.11 app/controllers/concerns/maintenance_standards.rb
importo-3.0.10 app/controllers/concerns/maintenance_standards.rb
importo-3.0.9 app/controllers/concerns/maintenance_standards.rb