Routing error UsersController - ruby-on-rails

I have a link_to that takes the users to their profile page. It used to work before but now I keep on getting a uninitialized constant UsersController.
Routes:
Rails.application.routes.draw do
resources :users
resources :questions
devise_for :users
root 'home#index'
get '/users/:id' => 'home#profile'
end
Index.html.erb:
<div class="row">
<div class="col-md-8">
<% if #questions.any? %>
<% #questions.each do |question| %>
<div class="well">
<div class="media">
<a class="pull-left">
<% if question.user.avatar.blank? %>
<img src="http://www.adtechnology.co.uk/images/UGM-default-user.png" style="width: 75px;">
<% else %>
<%= image_tag question.user.avatar, :style => "width:75px;" %>
<% end %>
</a>
<div class="media-body">
<h4 class="media-heading"><%= link_to question.title, question_path(question), :class => "ques" %></h4>
<p class="text-right">By <%= link_to question.user.username, question.user, :class => " bg" %></p> <!-- that's what's causing the error -->
<p class="text-muted"><%= truncate(question.description, :length => 50) %></p>
<ul class="list-inline navbar-right list-unstyled">
<li><span style="padding-right: 10px;" ><i class="fa fa-calendar"></i> asked <%= time_ago_in_words(question.created_at) %> ago </span></li>
</ul>
</div>
</div>
</div>
<% end %>
<% else %>
<p>No content yet</p>
<% end %>
Rake routes:
users_path GET /users(.:format) users#index
POST /users(.:format) users#create
new_user_path GET /users/new(.:format) users#new
edit_user_path GET /users/:id/edit(.:format) users#edit
user_path GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
questions_path GET /questions(.:format) questions#index
POST /questions(.:format) questions#create
new_question_path GET /questions/new(.:format) questions#new
edit_question_path GET /questions/:id/edit(.:format) questions#edit
question_path GET /questions/:id(.:format) questions#show
PATCH /questions/:id(.:format) questions#update
PUT /questions/:id(.:format) questions#update
DELETE /questions/:id(.:format) questions#destroy
new_user_session_path GET /users/sign_in(.:format) devise/sessions#new
user_session_path POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session_path DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password_path POST /users/password(.:format) devise/passwords#create
new_user_password_path GET /users/password/new(.:format) devise/passwords#new
edit_user_password_path GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration_path GET /users/cancel(.:format) devise/registrations#cancel
user_registration_path POST /users(.:format) devise/registrations#create
new_user_registration_path GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration_path GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
root_path GET / home#index
GET /users/:id(.:format) home#profile
As I said before, I don't really know what's causing the error. It was working properly yesterday and I didn't do any changes at all.

You should use <%= link_to home_profile(question.user.id) %>.
Assuming question.user.id get's user's corresponding id.
Acess users's id in Profile controller by params[:id].

I fixed it by putting the resources at the bottom instead:
Rails.application.routes.draw do
devise_for :users
root 'home#index'
get '/users/:id' => 'home#profile'
resources :users
resources :questions
end
My guess is that it was overriding the devise_for :users

Related

Nested routes with polymorphic association

I'm trying to implement the act_as_votable gem in my rails application. I got it to work on the blogs model, but the comments model is where I'm stuck. I get undefined methodlike_comment_path'` when I try to run it, and it's because there are no routes being generated like there are for the blog.
Here is the routes file:
resources :blogs do
member do
put 'like', to: 'blogs#upvote'
put 'dislike', to: 'blogs#downvote'
end
resources :comments
member do
put 'like', to: 'comments#upvote'
put 'dislike', to: 'comments#downvote'
end
end
On the blog index, I am able to call the blog like path just fine.
<div class="btn-group">
<%= link_to like_blog_path(blog), method: :put, class: "btn btn-default btn-sm" do %>
<span class="glyphicon glyphicon-chevron-up"></span>
Upvote
<%= blog.get_upvotes.size %>
<% end %>
<%= link_to dislike_blog_path(blog), method: :put, class: "btn btn-default btn-sm" do %>
<span class="glyphicon glyphicon-chevron-down"></span>
Downvote
<%= blog.get_downvotes.size %>
<% end %>
</div>
I run into trouble, though, with the comment part.
<div class="btn-group">
<%= link_to like_comment_path(#commentable, comment), method: :put, class: "btn btn-default btn-sm" do %>
<span class="glyphicon glyphicon-chevron-up"></span>
Upvote
<%= comment.get_upvotes.size %>
<% end %>
<%= link_to dislike_comment_path(#commentable, comment), method: :put, class: "btn btn-default btn-sm" do %>
<span class="glyphicon glyphicon-chevron-down"></span>
Downvote
<%= comment.get_downvotes.size %>
<% end %>
</div>
When I run rake routes, nothing for the comments comes up.
Prefix Verb URI Pattern Controller#Action
root GET / glips#index
pages_home GET /pages/home(.:format) pages#home
pages_about GET /pages/about(.:format) pages#about
pages_contact GET /pages/contact(.:format) pages#contact
tag GET /tags/:tag(.:format) glips#index
new_user_session GET /login(.:format) devise/sessions#new
user_session POST /login(.:format) devise/sessions#create
destroy_user_session DELETE /logout(.:format) devise/sessions#destroy
new_user_password GET /password/new(.:format) devise/passwords#new
edit_user_password GET /password/edit(.:format) devise/passwords#edit
user_password PATCH /password(.:format) devise/passwords#update
PUT /password(.:format) devise/passwords#update
POST /password(.:format) devise/passwords#create
cancel_user_registration GET /cancel(.:format) devise/registrations#cancel
new_user_registration GET /register(.:format) devise/registrations#new
edit_user_registration GET /edit(.:format) devise/registrations#edit
user_registration PATCH / devise/registrations#update
PUT / devise/registrations#update
DELETE / devise/registrations#destroy
POST / devise/registrations#create
like_blog PUT /blogs/:id/like(.:format) blogs#upvote
dislike_blog PUT /blogs/:id/dislike(.:format) blogs#downvote
blog_comments GET /blogs/:blog_id/comments(.:format) comments#index
POST /blogs/:blog_id/comments(.:format) comments#create
new_blog_comment GET /blogs/:blog_id/comments/new(.:format) comments#new
edit_blog_comment GET /blogs/:blog_id/comments/:id/edit(.:format) comments#edit
blog_comment GET /blogs/:blog_id/comments/:id(.:format) comments#show
PATCH /blogs/:blog_id/comments/:id(.:format) comments#update
PUT /blogs/:blog_id/comments/:id(.:format) comments#update
DELETE /blogs/:blog_id/comments/:id(.:format) comments#destroy
PUT /blogs/:id/like(.:format) comments#upvote
PUT /blogs/:id/dislike(.:format) comments#downvote
blogs GET /blogs(.:format) blogs#index
POST /blogs(.:format) blogs#create
new_blog GET /blogs/new(.:format) blogs#new
edit_blog GET /blogs/:id/edit(.:format) blogs#edit
blog GET /blogs/:id(.:format) blogs#show
PATCH /blogs/:id(.:format) blogs#update
PUT /blogs/:id(.:format) blogs#update
DELETE /blogs/:id(.:format) blogs#destroy
users GET /users(.:format) users#index
GET /users/:id(.:format) users#show
user GET /users/:id(.:format) users#show
I cannot figure out how to make the comment path work with the routes. What am I doing wrong?
Are you looking for nesting the :comments resource inside :blogs? Otherwise your routes should look like:
resources :blogs do
member do
put 'like', to: 'blogs#upvote'
put 'dislike', to: 'blogs#downvote'
end
end
resources :comments do
member do
put 'like', to: 'comments#upvote'
put 'dislike', to: 'comments#downvote'
end
end
(note you had a missing do at beginning of the :comments block which resulted in a weird block ending/nesting)

Two users#show, and how to redirect to my user profile after login

Happy Thursday everyone, I had a quick question on routes and redirecting. I am working on a rails assignment that asks that I redirect the router to his/her profile after signing in. How would I go about doing that? An after_sign_in method? Here is my routes:
Rails.application.routes.draw do
get 'users/show'
get 'users_controller/show'
devise_for :users
resources :users
get 'welcome/index'
root :to => 'welcome#index'
end
Users Controller:
class UsersController < ApplicationController
def show
#user = User.find(params[:id])
end
private
def user_params
params.require(:user).permit(:name, :email)
end
end
devise/sessions (Login Page)
<h2>Sign in</h2>
<div class="row">
<div class="col-md-8">
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div class="form-group">
<%= f.label :email %>
<%= f.email_field :email, autofocus: true, class: 'form-control', placeholder: "Enter email" %>
</div>
<div class="form-group">
<%= f.label :password %>
<%= f.password_field :password, class: 'form-control', placeholder: "Enter password" %>
</div>
<div class="form-group">
<% if devise_mapping.rememberable? %>
<%= f.label :remember_me, class: 'checkbox' do %>
<%= f.check_box :remember_me %> Remember me
<% end %>
<% end %>
<%= f.submit "Sign in", class: 'btn btn-success' %>
</div>
<div class="form-group">
<%= render "devise/shared/links" %>
</div>
<% end %>
</div>
</div>
Thanks for your help! Also could anyone answer why my rake routes has two users#show? I know only one functions (the one with the user_id) so I don't know how two were created.
Rake Routes Output:
rake routes
Prefix Verb URI Pattern Controller#Action
users_show GET /users/show(.:format) users#show
users_controller_show GET /users_controller/show(.:format) users_controller#show
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
user_confirmation POST /users/confirmation(.:format) devise/confirmations#create
new_user_confirmation GET /users/confirmation/new(.:format) devise/confirmations#new
GET /users/confirmation(.:format) devise/confirmations#show
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
welcome_index GET /welcome/index(.:format) welcome#index
root GET /
welcome#index
Define after_sign_in_path_for in ApplicationController. Read this: https://github.com/plataformatec/devise/wiki/How-To%3A-Redirect-to-a-specific-page-on-successful-sign-in-and-sign-out
By default, Devise will redirect the user to the root_path after signing in. You can simply change the root setting in config/routes.rb to the desired path, or add a user_root_path, e.g.
get '/welcome' => "welcome#index", as: :user_root
as describe in the Devise wiki.
As to the two routes, note that your routes.rb includes these two statements:
get 'users/show'
resources :users
resources automatically adds a route at GET /users/:id mapping to UsersController#show, which is what you want. The other route should be removed, along with get 'users_controller/show'. More info on this can be found in the Rails Routing Guide.
In the applicaion controller
def after_sign_in_path_for(user)
the link that you want
end
in your example
def after_sign_in_path_for(user)
user_path(current_user.id)
end

Rails: No route matches {:action=>"edit", :controller=>"discussions"

My discussions are nested within my projects. Projects is a basic CRUD and I'm trying to make discussions the same. They originally worked, but now I'm trying to add "edit" and "destroy" and I'm getting this error: No route matches {:action=>"edit", :controller=>"discussions", :format=>nil, :id=>nil, :project_id=>#<Discussion id: 24, title: "hello", description: "hello", created_at: "2015-02-02 20:58:53", updated_at: "2015-02-02 20:58:53", project_id: 12>} missing required keys: [:id]
for this line of code here <%= link_to "Edit", edit_project_discussion_path(item) %>.
discussions_controller.rb
class DiscussionsController < ApplicationController
def new
#project = Project.find(params[:project_id])
#discussion = Discussion.new
end
def create
#project = Project.find(params[:project_id])
#discussion = #project.discussions.build(discussion_params)
if #discussion.save
redirect_to new_project_discussion_path(#project)
end
end
def edit
#discussions = Discussion.find(params[:project_id])
end
def update
#discussions = Discussion.find(params[:project_id])
if #discussions.update_attributes(discussion_params)
redirect_to new_project_discussion_path
else
render "edit"
end
end
def destroy
#discussions = Discussion.find(params[:project_id])
#discussions.destroy
redirect_to new_project_discussion_path
end
def discussion_params
params.require(:discussion).permit(:project_id, :title, :description)
end
end
_form.html.erb
<%= form_for [#project, #discussion] do |f| %>
<div class="container">
Project: <%= #project.title %> <%= link_to "Go back?", projects_path %>
<hr>
<div class="form-group">
<%= f.label :title %>
<%= f.text_field :title, class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :description %>
<%= f.text_area :description, class: "form-control" %>
</div>
<div class="form-group">
<%= f.submit "Submit discussion", class: "btn btn-primary" %>
</div>
</div>
<% end %>
edit.html.erb
<%= render "form" %>
new.html.erb
<div class="container">
<div class="page-header">
<h1>Discussions<small> Discuss the project.</small></h1>
</div>
</div>
<%= render "form" %>
<% if !#project.discussions.blank? %>
<% for item in #project.discussions %>
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<%= item.title %>
</div>
</div>
<div class="panel-body">
<p>
<%= item.description %> <br>
<%= link_to "Comment", new_discussion_comment_path(item) %>
<%= link_to "Delete", item, :method => :delete %>
<%= link_to "Edit", edit_project_discussion_path(item) %> |
</p>
</div>
</div>
<% end %>
<% end %>
Routes:
Controller#Action
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
homes GET /homes(.:format) homes#index
POST /homes(.:format) homes#create
new_home GET /homes/new(.:format) homes#new
edit_home GET /homes/:id/edit(.:format) homes#edit
home GET /homes/:id(.:format) homes#show
PATCH /homes/:id(.:format) homes#update
PUT /homes/:id(.:format) homes#update
DELETE /homes/:id(.:format) homes#destroy
project_discussions GET /projects/:project_id/discussions(.:format) discussions#index
POST /projects/:project_id/discussions(.:format) discussions#create
new_project_discussion GET /projects/:project_id/discussions/new(.:format) discussions#new
edit_project_discussion GET /projects/:project_id/discussions/:id/edit(.:format) discussions#edit
project_discussion GET /projects/:project_id/discussions/:id(.:format) discussions#show
PATCH /projects/:project_id/discussions/:id(.:format) discussions#update
PUT /projects/:project_id/discussions/:id(.:format) discussions#update
DELETE /projects/:project_id/discussions/:id(.:format) discussions#destroy
projects GET /projects(.:format) projects#index
POST /projects(.:format) projects#create
new_project GET /projects/new(.:format) projects#new
edit_project GET /projects/:id/edit(.:format) projects#edit
project GET /projects/:id(.:format) projects#show
PATCH /projects/:id(.:format) projects#update
PUT /projects/:id(.:format) projects#update
DELETE /projects/:id(.:format) projects#destroy
discussion_comments GET /discussions/:discussion_id/comments(.:format) comments#index
POST /discussions/:discussion_id/comments(.:format) comments#create
new_discussion_comment GET /discussions/:discussion_id/comments/new(.:format) comments#new
edit_discussion_comment GET /discussions/:discussion_id/comments/:id/edit(.:format) comments#edit
discussion_comment GET /discussions/:discussion_id/comments/:id(.:format) comments#show
PATCH /discussions/:discussion_id/comments/:id(.:format) comments#update
PUT /discussions/:discussion_id/comments/:id(.:format) comments#update
DELETE /discussions/:discussion_id/comments/:id(.:format) comments#destroy
discussions GET /discussions(.:format) discussions#index
POST /discussions(.:format) discussions#create
new_discussion GET /discussions/new(.:format) discussions#new
edit_discussion GET /discussions/:id/edit(.:format) discussions#edit
discussion GET /discussions/:id(.:format) discussions#show
PATCH /discussions/:id(.:format) discussions#update
PUT /discussions/:id(.:format) discussions#update
DELETE /discussions/:id(.:format) discussions#destroy
root GET / homes#index
I'm unsure if any of my projects_controller.rb info is needed but if so I will update.
edit_project_discussion_path requires a Project and a Discussion.
/projects/:project_id/discussions/:id/edit(.:format)
You are only sending the Discussion item as the project parameter.
<%= link_to "Edit", edit_project_discussion_path(item) %>
You need to change that to include the project:
<%= link_to "Edit", edit_project_discussion_path(#project, item) %>

What route to use to link to resource creator?

My goal is to link the <%= #thing.user.username %> to the user's profile. I know it's something like:
<%= link_to #thing.user.username, %>
But what goes after the comma?
I can currently navigate to a user by going to "localhost:3000/users/UserNameHere". How do I link to that page dynamically?
Each of my Things has a line showing what user posted it. Here is how Things are displayed:
<div class='row'>
<div class='col-md-offset-2 col-md-8'>
<div class='panel panel-default'>
<div class='panel-heading text-center'>
<%= image_tag #thing.image.url(:medium) %>
</div>
<div class='panel-body'>
<p>
<strong><%= #thing.title %></strong>
</p>
<p>
<%= #thing.description %>
</p>
<p>
<%= #thing.user.username %>
</p>
<% if #thing.user == current_user %>
<%= link_to edit_thing_path(#thing) do %>
<span class='glyphicon glyphicon-edit'></span>
<% end %>
<% end %>
</div>
</div>
</div>
Here is my UsersController:
class UsersController < ApplicationController
def show
#user = User.find_by_id(params[:id])
end
end
Here are my routes:
Stynyl::Application.routes.draw do
resources :things
devise_for :users
get '/about', to: 'pages#about'
root 'things#index'
get 'users/:username' => "users#show"
end
Here is my rake routes output:
Prefix Verb URI Pattern Controller#Action
things GET /things(.:format) things#index
POST /things(.:format) things#create
new_thing GET /things/new(.:format) things#new
edit_thing GET /things/:id/edit(.:format) things#edit
thing GET /things/:id(.:format) things#show
PATCH /things/:id(.:format) things#update
PUT /things/:id(.:format) things#update
DELETE /things/:id(.:format) things#destroy
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
about GET /about(.:format) pages#about
root GET / things#index
GET /users/:username(.:format) users#show
You should stick to REST conventions in Rails, so use resources.
Replace:
get 'users/:username' => "users#show"
with:
resources :users, only: [:show]
then:
<%= link_to #thing.user.username, user_path(#thing.user.username) %>
or:
<%= link_to #thing.user.username, #thing.user %>
#and in model
def to_param
username
end
And replace params[:username] with params[:id] in your action.

undefined method `username' for nil:NilClass when signing up and signing in

Whenever I try to log in and sign up, I am hit with this error:
undefined method `username' for nil:NilClass
on these two lines:
<strong><%= #user.username %></strong> <br>
<strong><%= #user.name %></strong>
Here is the full error from the server's output:
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."username" = 'sign_in' LIMIT 1
Rendered users/show.html.erb within layouts/application (2.1ms)
Completed 500 Internal Server Error in 7ms
ActionView::Template::Error (undefined method `username' for nil:NilClass):
1: <strong><%= #user.username %></strong> <br>
2: <strong><%= #user.name %></strong>
3: <%= debug #user %>
4:
app/views/users/show.html.erb:1:in `_app_views_users_show_html_erb__1133891108745893964_2164088020'
Here are my routes:
Stynyl::Application.routes.draw do
resources :things
resources :users, only: [:show]
devise_for :users
get '/about', to: 'pages#about'
root 'things#index'
end
Here is my user show view
<strong><%= #user.username %></strong> <br>
<strong><%= #user.name %></strong>
<div id="things" class="transitions-enabled">
<% #user.things.each do |thing| %>
<div class='panel panel default'>
<div class="box">
<%= link_to image_tag(thing.image.url(:medium)), thing %>
<div class='panel-body'>
<strong><p><%= thing.title %></p></strong>
<p><%= thing.description %></p>
By <%= link_to thing.user.username, thing.user %>
<% if thing.user == current_user %>
<%= link_to edit_thing_path(thing) do %>
<span class='glyphicon glyphicon-edit'></span> Edit
<% end %>
<%= link_to thing_path(thing), method: :delete, data: { confirm: 'Are you sure?' } do %>
<span class='glyphicon glyphicon-trash'></span> Delete
<% end %>
</div>
<% end %>
</div>
</div>
<% end %>
</div>
Here is my UsersController file:
class UsersController < ApplicationController
def show
#user = User.find_by_username(params[:id])
end
end
Output of rake routes:
Prefix Verb URI Pattern Controller#Action
things GET /things(.:format) things#index
POST /things(.:format) things#create
new_thing GET /things/new(.:format) things#new
edit_thing GET /things/:id/edit(.:format) things#edit
thing GET /things/:id(.:format) things#show
PATCH /things/:id(.:format) things#update
PUT /things/:id(.:format) things#update
DELETE /things/:id(.:format) things#destroy
users POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
user GET /users/:id(.:format) users#show
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
about GET /about(.:format) pages#about
root GET / things#index
Edits
I also noticed that when I delete all of the code from the User show view, I can get to the signup and login pages, but they are blank. Can we safely guarantee that the problem is in the view? I'm so perplexed at how something in the show view can affect the ability to sign in and sign up!
I have also observed that when I add content to the users show view, it appears on the sign up and login pages. What on earth is going on?
The reason is because of a conflict in your routes. When matching a request to a route, Rails will go through your routes sequentially. But your order shows:
user GET /users/:id(.:format) users#show
new_user_session GET /users/sign_in(.:format) devise/sessions#new
And so Rails is passing sign_in as the :id parameter to your user show method, instead of being caught by devise's new_user_session_path. Changing the order will fix the problem.
TL:DR; devise_for :users should be declared before resources :users.

Resources