Sha256: 203df3a7a7949b73f10bdef8a261ccf0d247c53d7e0f0953d5c630b5112d9996
Contents?: true
Size: 563 Bytes
Versions: 57
Compression:
Stored size: 563 Bytes
Contents
module Mumuki::Laboratory::Controllers::ActionRedirector def save_location_before!(action) session[redirection_variable_for(action)] = origin end def redirect_after!(action, fallback_location: root_path) redirection_variable = redirection_variable_for(action) destination = session.delete(redirection_variable).presence redirect_to(destination || fallback_location) end private def redirection_variable_for(action) "redirect_after_#{action}" end def origin Addressable::URI.heuristic_parse(request.path).to_s end end
Version data entries
57 entries across 57 versions & 1 rubygems