Dessy
Dessy

Reputation: 1

Devise gem bundled but server indicating error

I am a newbie and would need some assistance. I added devise gem to my Instagram clone app and added "sign up", sign in", "sign out", and "edit profile" links onto my navbar afterwards but my server is indicating a NoMethodError. I have carefully observed the routes from the rails routes and added them to the links but its still not working.

Below is are the links created.

      <li class= "nav-item">
        <%= link_to "Sign Up", new_user_registration_path, class: "nav-link"%>
      </li>

       <li class= "nav-item">
        <%= link_to "Sign In", new_user_session_path, class: "nav-link"%>
      </li>

       <li class= "nav-item">
        <%= link_to "Sign Out",  destroy_user_session_path, class: "nav-link"%>
      </li>

       <li class= "nav-item">
        <%= link_to "Edit Profile", edit_user_registration_path, method: :delete, class: "nav-link"%>
      </li>

Below is what i have got in my routes.rb

Rails.application.routes.draw do
  
  devise_scope :user do
    get '/users', to: 'devise/registrations#new'
    get '/users/password', to: 'devise/passwords#new'
    get '/users/sign_out' => 'devise/sessions#destroy'
  end


  devise_for :users
  get 'posts/new'
  get 'home/about'
  resources :posts
  # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

  # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
  # Can be used by load balancers and uptime monitors to verify that the app is live.
  get "up" => "rails/health#show", as: :rails_health_check

  # Defines the root path route ("/")
  root "posts#index"
end

This is what the error looks like. Thanks

NoMethodError
undefined method `devise_scope' for #<ActionDispatch::Routing::Mapper:0x00007fe912a6e430 @set=#<ActionDispatch::Routing::RouteSet:0x00007fe921d90f00>,

@draw_paths=[#Pathname:/Users/dessy/.rvm/gems/ruby-3.0.0/gems/actionview-7.1.3.4/config/routes, #Pathname:/Users/dessy/.rvm/gems/ruby-3.0.0/gems/activestorage-7.1.3.4/config/routes, #Pathname:/Users/dessy/.rvm/gems/ruby-3.0.0/gems/actioncable-7.1.3.4/config/routes, #Pathname:/Users/dessy/.rvm/gems/ruby-3.0.0/gems/actionmailbox-7.1.3.4/config/routes, #Pathname:/Users/dessy/.rvm/gems/ruby-3.0.0/gems/actiontext-7.1.3.4/config/routes, #Pathname:/Users/dessy/.rvm/gems/ruby-3.0.0/gems/importmap-rails-2.0.1/config/routes, #Pathname:/Users/dessy/.rvm/gems/ruby-3.0.0/gems/turbo-rails-2.0.6/config/routes, #Pathname:/Users/dessy/.rvm/gems/ruby-3.0.0/gems/stimulus-rails-1.3.3/config/routes, #Pathname:/Users/dessy/Desktop/Ruby/PROJECTS/Odin-insta/config/routes, #Pathname:/Users/dessy/Desktop/Ruby/PROJECTS/Odin-insta/config/routes], @scope=#<ActionDispatch::Routing::Mapper::Scope:0x00007fe912a6e3e0 @hash={:path_names=>{:new=>"new", :edit=>"edit"}}, @parent=#<ActionDispatch::Routing::Mapper::Scope:0x00007fe92491c048 @hash=nil, @parent=nil, @scope_level=nil>, @scope_level=nil>, @concerns={}>

Upvotes: 0

Views: 69

Answers (0)

Related Questions