Ruby on Rails: Authorization

gem 'devise', '~> 4.7', '>= 4.7.1'
rails generate devise:install
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
rails g devise:views
rails generate devise MODEL
devise_for :users, path: '', path_names:{sign_in: 'login', sign_out: 'logout', sign_up: 'register'}
<%= link_to "Logout", destroy_user_session_path, method: :delete, class: style %>
if current_user.is_a?(GuestUser) 
<%=link_to "Register", new_user_registration_path =>
<%= link_to "Login", new_user_session_path %>
else
<%= link_to "Logout", destroy_user_session_path, method: :delete%>
end

--

--

Problem solver with experience in Software, and Mechanical engineering. Interested in web-dev, machine learning, artificial intelligence, and new technologies.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Avitosh Totaram

Avitosh Totaram

Problem solver with experience in Software, and Mechanical engineering. Interested in web-dev, machine learning, artificial intelligence, and new technologies.