Module: Refinery::AuthenticatedSystem

Defined in:
lib/refinery/authenticated_system.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



65
66
67
68
69
70
# File 'lib/refinery/authenticated_system.rb', line 65

def self.included(base)
  if base.respond_to? :helper_method
    base.send :helper_method, :current_refinery_user, :current_user_session,
                              :refinery_user_signed_in?, :refinery_user?
  end
end

Instance Method Details

#after_sign_in_path_for(resource_or_scope) ⇒ Object

This just defines the devise method for after sign in to support extension namespace isolation…



48
49
50
51
52
# File 'lib/refinery/authenticated_system.rb', line 48

def (resource_or_scope)
  pop_stored_location ||
  sanitized_stored_location_for(resource_or_scope) ||
  signed_in_root_path(resource_or_scope)
end

#after_sign_out_path_for(resource_or_scope) ⇒ Object



54
55
56
# File 'lib/refinery/authenticated_system.rb', line 54

def after_sign_out_path_for(resource_or_scope)
  refinery.root_path
end

#signed_in_root_path(resource_or_scope) ⇒ Object

This defines the devise method for refinery routes



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/refinery/authenticated_system.rb', line 22

def signed_in_root_path(resource_or_scope)
  scope = Devise::Mapping.find_scope!(resource_or_scope)
  home_path = "#{scope}_root_path"
  if respond_to?(home_path, true)
    refinery.send(home_path)
  elsif respond_to?(:admin_root_path)
    refinery.admin_root_path
  else
    "/"
  end
end