Module: Bpluser::Controller::InstanceMethods

Defined in:
lib/bpluser/controller.rb

Constant Summary collapse

EXCLUDE_PATHS =
%w[
  /users/auth
  /users/sign_in
  /users/sign_up
  /users/password
  /users/password/new
  /users/password/edit
  /users/confirmation
  /users/sign_out
].freeze

Instance Method Summary collapse

Instance Method Details

#after_sign_in_path_for(resource_or_scope) ⇒ Object



34
35
36
# File 'lib/bpluser/controller.rb', line 34

def (resource_or_scope)
  stored_location_for(resource_or_scope) || root_path
end

#store_locationObject

redirect after login to previous non-login page TODO figure out why it doesn’t work for Polaris



27
28
29
30
31
32
# File 'lib/bpluser/controller.rb', line 27

def store_location
  # Don't store if ajax call or fullpath doesn't include segments in EXCLUDE_PATHS const
  return if !request.get? || request.xhr? || EXCLUDE_PATHS.any? { |exclude_path| request.fullpath.include?(exclude_path) }

  store_location_for(:user, request.fullpath)
end