Created
November 17, 2012 10:12
Instructions to setup devise
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
# Add devise to Gemfile | |
gem 'devise' | |
# Run bundle | |
bundle install | |
# Run devise install | |
rails generate devise:install | |
# Make sure alert code in application.html.erb | |
<% flash.each do |name, msg| %> | |
<%= content_tag :div, msg, :id => "flash_#{name}" %> | |
<% end %> | |
# Generate User Info Model | |
# Model name can be anything like, | |
# User Subscriber Employee etc. | |
rails generate devise MODEL | |
# Migrate Database | |
rake db:migrate | |
# Rake Routes now shows provided routes | |
# Following snippet of code to show user state | |
<% if user_signed_in? %> | |
Signed in as <%= current_user.email %>. Not you? | |
<%= link_to "Sign Out", destroy_user_session_path, :method => :delete %> | |
<% else %> | |
<%= link_to "Sign Up", new_user_registration_path %> or <%= link_to "Sign In", new_user_session_path %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment