Skip to content

Instantly share code, notes, and snippets.

@sathishmanohar
Created November 17, 2012 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sathishmanohar/4094666 to your computer and use it in GitHub Desktop.
Save sathishmanohar/4094666 to your computer and use it in GitHub Desktop.
Instructions to setup devise
# 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