I am a newbie and would need some assistance. i added a devise gem and added 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
Dessy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.