Created
April 14, 2013 03:02
-
-
Save beakr/5381228 to your computer and use it in GitHub Desktop.
Neat little widget for Devise greeting the user in a random language.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# Make sure you declare the use of utf-8 | |
# so you can use characters from other | |
# languages. | |
module ApplicationHelper | |
def greeting | |
# Add more here | |
greetings = ['Hello', 'Greetings', 'Hi', 'Kon\'nichiwa', 'Bonjour', | |
'Cześć', 'Olá', 'Hallo', 'Hei', 'Hallå'] | |
# Select a random greeting | |
greetings.sample | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%# In your layout somewhere... %> | |
<% if !user_signed_in? %> | |
<%= link_to 'Sign in', new_user_session_path %> or <%= link_to 'Sign up', new_user_registration_path %> | |
<% else %> | |
<%= greeting %> <% current_user.email %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment