Skip to content

Instantly share code, notes, and snippets.

@zeitan
Created August 15, 2012 16:21
Show Gist options
  • Save zeitan/3361358 to your computer and use it in GitHub Desktop.
Save zeitan/3361358 to your computer and use it in GitHub Desktop.
<% if user_signed_in? %>
<p class="grid_12 derecha">
<span class="persona" id="ficha" data-ficha="<%= current_user.id %>"><%= current_user.nombres %></small></span>  |  <span class="logout"><%= link_to('Salir', destroy_user_session_path) %></span>
<% else %>
def after_sign_in_path_for(resource_or_scope)
empleado = Empleado.find(current_user.id)
current_user.nombres = (empleado.nombres + ' ' + empleado.apellidos).titleize
Rails.logger.debug("My object: #{current_user.nombres}")
#RAILS_DEFAULT_LOGGER.debug current_user.nombres
case resource_or_scope
when :user, User
store_location = session[:return_to]
clear_stored_location
(store_location.nil?) ? "/overview" : store_location.to_s
else
super
end
end
My object: --- !ruby/object:User
attributes:
created_at: 2011-08-24 19:57:55.027023
estado_id: "1"
last_sign_in_ip: 127.0.0.1
updated_at: 2012-08-15 11:57:25.684891 -04:30
last_sign_in_at: 2012-08-15T09:44:13+00:00
id: 30018076
sign_in_count: 59
remember_token:
current_sign_in_ip: 127.0.0.1
ldap_attributes:
remember_created_at:
current_sign_in_at: 2012-08-15 11:57:25.633339 -04:30
login: antonio.bastardo
attributes_cache: {}
changed_attributes: {}
ficha: 30018076
new_record_before_save: false
nombres: Antonio Jose Bastardo Salas
--- !ruby/object:User attributes: created_at: 2011-08-24 19:57:55.027023 estado_id: "1" last_sign_in_ip: 127.0.0.1 updated_at: 2012-08-15 11:57:25.684891 last_sign_in_at: 2012-08-15 09:44:13 id: "30018076" sign_in_count: "59" remember_token: current_sign_in_ip: 127.0.0.1 ldap_attributes: remember_created_at: current_sign_in_at: 2012-08-15 11:57:25.633339 login: antonio.bastardo attributes_cache: {} roles: - !ruby/object:Rol attributes: name: admin rol_id: "3" created_at: updated_at: id: "3" user_id: "30018076" attributes_cache: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment