GithubHelp home page GithubHelp logo

how_to_use_clearance's Introduction

#Clearance Clearance is a simple Ruby on Rails authentication with email & password.

To setup Clearance, visit this page: https://github.com/thoughtbot/clearance or follow the following steps below:

  1. add gem ‘clearance’ into Gemfile

  2. run bundle in the terminal

  3. run rails generate clearance:install in the terminal

  4. add config.action_mailer.default_url_options = { host: 'localhost:3000' } into config/environments/development.rb and also config/environments/test.rb

  5. add the following code into views/home/index.html.erb or your navigation bar or your root page

  <% if signed_in? %>
    Signed in as: <%= current_user.email %>
    <%= button_to 'Sign out', sign_out_path, method: :delete %>
  <% else %>
    <%= link_to 'Sign in', sign_in_path %>
    <%= link_to 'Sign Up', sign_up_path %>
  <% end %>

  <div id="flash">
    <% flash.each do |key, value| %>
      <div class="flash <%= key %>"><%= value %></div>
    <% end %>
  </div>
  1. run bundle exec rake db:migrate in the terminal

  2. make sure the following code root 'home#index' is in config/routes.rb (*optional if you have root page)

  3. run rails g migration add_three_columns_to_users_for_clearance in the terminal

  4. go to db/migrate and find <timestamps>_add_three_columns_to_users_for_clearance.rb add the following code into the file:

  add_column :users, :encrypted_password, :string
  add_column :users, :remember_token, :string
  add_column :users, :confirmation_token, :string 
  1. run bundle exec rake db:migrate in the terminal

  2. make sure users table has encrypted_password, confirmation_token, remember_token columns

#References

  1. https://github.com/thoughtbot/clearance

#Errors and solutions

  1. https://github.com/estelleccl/how_to_use_clearance/blob/master/Errors_and_solutions.md

how_to_use_clearance's People

Contributors

estelleccl avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.