Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (24 sloc) 0.64 kb
module Comeback
def self.included(base)
base.class_inheritable_accessor :comeback_session_key
base.comeback_session_key = :comeback_to
end
def store_location(url=nil)
session[comeback_session_key] ||= url ? url : request.url
end
def store_referer
referer = request.env['HTTP_REFERER']
store_location(referer) unless referer == request.url
end
def clear_location
session[comeback_session_key] = nil
end
def return_or_redirect_to(*args)
if session[comeback_session_key]
redirect_to(session[comeback_session_key])
clear_location
else
redirect_to(*args)
end
end
end
Jump to Line
Something went wrong with that request. Please try again.