Module: MaintenanceStandards

Included in:
Importo::ApplicationController
Defined in:
app/controllers/concerns/maintenance_standards.rb

Instance Method Summary collapse

Instance Method Details

#flash_and_redirect(result, path, notice, error, render_action = :edit) ⇒ Object

Informs the user and redirects when needed



12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/concerns/maintenance_standards.rb', line 12

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