Skip to content

Instantly share code, notes, and snippets.

@alishersadikov
Created October 26, 2016 19:37
Show Gist options
  • Save alishersadikov/7b817b280805e7cda7bf54fd362beb82 to your computer and use it in GitHub Desktop.
Save alishersadikov/7b817b280805e7cda7bf54fd362beb82 to your computer and use it in GitHub Desktop.
To use Bcrypt:
uncomment "gem 'bcrypt', '~> 3.1.7'" in Gemfile
User model should have password_digest attribute
add "has_secure_password" to User
add "validates_confirmation_of :password" to User (if you have password confirmation which you should!)
To display flash messages:
add the following to views/layouts/application.html.erb right before yield line:
<% flash.each do |key, value| %>
<div class="alert -<%= key %>">
<%= value %>
</div>
<% end %>
To use RSpec with Capybara:
add gem 'rspec-rails' and gem 'capybara' to Gemfile
in rails_helper.rb: require 'capybara/rails' and add "config.include Capybara::DSL" to config block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment