Devise Run :: Self Not see any code :: Devise.self == 7.5 Minutes
Rails Devise
1. gem 'devise' and $ bundle
2 $ rails g devise:install
3 $ rails g devise User + $ rails db:migrate
<a href="/users/sign_out"><span>SignOut</span></a>
<% else %>
<%end%>
7. config.sign_out_via = [:delete, :get]
Inside devise.rb write it.
...............................................................
1 gem 'devise' and $ bundle
2 $ rails g devise:install
3 $ rails g devise User + $ rails db:migrate
4 $ rails g controller home index
5 get ‘home/index’ , root 'home#index’ :: Routes
6 – config/enviornment/development.rb::
config.action_mailer.default_url_options = {host: 'localhost', port: 3000}
7. before_action :authenticate_user! :: application_controller.rb
8. Add the simple code to show the proper links of signin,signup and signout:: many times written
inside the application.html.erb
<% if user_signed_in? %>
<a href="/users/sign_out"><span>SignOut</span></a>
<% else %>
<a href="/users/sign_up"><span>SignUp</span></a>
<%end%>
note - extra sigin is coming after this --
now do this --
<% if user_signed_in? %>
<a href="/users/sign_out"><span>SignOut</span></a>
<% else %>
<%end%>
9. Is showing routing Error in this
Inside devise.rb write :: config.sign_out_via = [:delete, :get] ::: We added get method in it before this only delete
Note :: Keep in note that signed_in? Should be not should be signed_in ? :: Means space
should not be there in the signed_in and ?
9.changes in devise.rb :: In Initilizers :: devise.rb :: 269
config.sign_out_via = [:delete, :get] :::::::::::::::::::::: Now:: Add the get Action in it
config.sign_out_via =:delete ::::::::::::: Before
10. undefined method `devise_for' in rails --
config.navigational_formats = ['*/*', :html, :turbo_stream]
add above line in devise.rb anywhere
config.navigational_formats = ['*/*', :html, :turbo_stream]
restart the server again - rails say that for every gem add restart me pls
11. With Rails 7 this error is coming now a days after signup -
this error ::
undefined method `user_url' for Devise SessionsController:create
to resolve this error go to devise.rb and add this below line anywhere in devise .rb ::
config.navigational_formats = ['*/*', :html, :turbo_stream]
after this restart the server and sign up again
12.
nvm install v14.10.1
bundle exec rails webpacker:install
OR
bundle add webpackerrails webpacker:installNote :: After this Change in devise.rb of the get action :: definately you should restart the
server then Sign out function will start work and this changes is done after the error of sign
out working not properly
Note :::: Most Important :: You can Check the Path at the Rake Routes or Rails routes or
rails routes | grep users, In this case the given path is not working then do it.
13.
Undefined Method devise_for ::
restart the server again and localhost:3000
14.
Comments
Post a Comment