Note that there are some explanatory texts on larger screens.

plurals
  1. PONo route matches {:action=>"show", :controller=>"users"} Error
    text
    copied!<p>I have the following going on:</p> <p>rspec test in users_controller_spec:</p> <pre><code>it "should redirect to the user show page" do post :create, :user =&gt; @attr response.should redirect_to(user_path(assigns(:user))) end </code></pre> <p>In my users_controller I have the following:</p> <pre><code>def show @user = User.find(params[:id]) @title = @user.name end def create @title = "Sign up" @user = User.new(params[:user]) if @user.save redirect_to @user, :notice =&gt; "Signed Up!" else @title = "Sign up" render "new" end end </code></pre> <p>In my routes.rb I have the following:</p> <pre><code> Psra::Application.routes.draw do resources :users resources :sessions # Root Route root :to =&gt; 'pages#home' # Pages Routes match '/contact', :to =&gt; 'pages#contact' match '/about', :to =&gt; 'pages#about' match '/help', :to =&gt; 'pages#help' match '/signup', :to =&gt; 'users#new' # Users Route match '/signup', :to =&gt; 'users#new' #Sessions Routes get "logout" =&gt; "sessions#destroy", :as =&gt; "logout" get "login" =&gt; "sessions#new", :as =&gt; "login" end </code></pre> <p>And Here is my rake routes</p> <pre><code> users GET /users(.:format) {:action=&gt;"index", :controller=&gt;"users"} POST /users(.:format) {:action=&gt;"create", :controller=&gt;"users"} new_user GET /users/new(.:format) {:action=&gt;"new", :controller=&gt;"users"} edit_user GET /users/:id/edit(.:format) {:action=&gt;"edit", :controller=&gt;"users"} user GET /users/:id(.:format) {:action=&gt;"show", :controller=&gt;"users"} PUT /users/:id(.:format) {:action=&gt;"update", :controller=&gt;"users"} DELETE /users/:id(.:format) {:action=&gt;"destroy", :controller=&gt;"users"} sessions GET /sessions(.:format) {:action=&gt;"index", :controller=&gt;"sessions"} POST /sessions(.:format) {:action=&gt;"create", :controller=&gt;"sessions"} new_session GET /sessions/new(.:format) {:action=&gt;"new", :controller=&gt;"sessions"} edit_session GET /sessions/:id/edit(.:format) {:action=&gt;"edit", :controller=&gt;"sessions"} session GET /sessions/:id(.:format) {:action=&gt;"show", :controller=&gt;"sessions"} PUT /sessions/:id(.:format) {:action=&gt;"update", :controller=&gt;"sessions"} DELETE /sessions/:id(.:format) {:action=&gt;"destroy", :controller=&gt;"sessions"} root / {:controller=&gt;"pages", :action=&gt;"home"} contact /contact(.:format) {:controller=&gt;"pages", :action=&gt;"contact"} about /about(.:format) {:controller=&gt;"pages", :action=&gt;"about"} help /help(.:format) {:controller=&gt;"pages", :action=&gt;"help"} signup /signup(.:format) {:controller=&gt;"users", :action=&gt;"new"} /signup(.:format) {:controller=&gt;"users", :action=&gt;"new"} logout GET /logout(.:format) {:action=&gt;"destroy", :controller=&gt;"sessions"} login GET /login(.:format) {:action=&gt;"new", :controller=&gt;"sessions"} </code></pre> <p>This all results in the following error:</p> <pre><code>1) UsersController POST 'create' success should redirect to the user show page Failure/Error: response.should redirect_to(user_path(assigns(:user))) ActionController::RoutingError: No route matches {:action=&gt;"show", :controller=&gt;"users"} # ./spec/controllers/users_controller_spec.rb:95:in `block (4 levels) in &lt;top (required)&gt;' </code></pre> <p>Any ideas on what I'm doing wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload