Module: Rad::ControllerMiscellaneousHelper

Defined in:
lib/rad/web/_controller_miscellaneous_helper.rb

Instance Method Summary collapse

Instance Method Details

#reload_pageObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rad/web/_controller_miscellaneous_helper.rb', line 2

def reload_page
  params = workspace.params
  params.format.must_be.in 'html', 'js'

  keep_flash!
  if params.format == 'js'
    workspace.response.set!(
      status: :ok,
      content_type: Mime[params.format]
    )
    throw :halt, "window.location.reload();"
  else
    redirect_to request.env["HTTP_REFERER"]
  end
end