Class: Spree::UserLastUrlStorer
- Inherits:
-
Object
- Object
- Spree::UserLastUrlStorer
- Defined in:
- app/models/spree/user_last_url_storer.rb,
app/models/spree/user_last_url_storer/rules/authentication_rule.rb
Overview
This service object is responsible for storing the current path into into ‘session` for redirects after successful user/admin authentication.
Defined Under Namespace
Modules: Rules
Class Method Summary collapse
-
.rules ⇒ Spree::Core::ClassConstantizer::Set
Lists all the rules that will be evaluated before storing the current path value into the session.
Instance Method Summary collapse
-
#initialize(controller) ⇒ UserLastUrlStorer
constructor
A new instance of UserLastUrlStorer.
-
#store_location ⇒ Object
Stores into session the request full path for future redirects (to be used after successful authentication).
Constructor Details
#initialize(controller) ⇒ UserLastUrlStorer
Returns a new instance of UserLastUrlStorer.
27 28 29 |
# File 'app/models/spree/user_last_url_storer.rb', line 27 def initialize(controller) @controller = controller end |
Class Method Details
.rules ⇒ Spree::Core::ClassConstantizer::Set
Lists all the rules that will be evaluated before storing the current path value into the session.
21 22 23 |
# File 'app/models/spree/user_last_url_storer.rb', line 21 def self.rules Spree::Config.user_last_url_storer_rules end |
Instance Method Details
#store_location ⇒ Object
Stores into session the request full path for future redirects (to be used after successful authentication). When there is a rule match then the request full path is not stored.
34 35 36 37 38 |
# File 'app/models/spree/user_last_url_storer.rb', line 34 def store_location return if self.class.rules.any? { |rule| rule.match? controller } session[:spree_user_return_to] = request.fullpath.gsub('//', '/') end |