I have a problem with setting up user routes in a rails application.
In routes.rb I added resources :users.
TestApp::Application.routes.draw do
resources :users
root :to => 'xxx#home'
match '/about', to: 'xxx#about'
match '/test', to: 'xxx#test'
match '/news', to: 'xxx#news'
match '/signup', to: 'users#new'
end
In users_controller.rb I added:
class UsersController < ApplicationController
def new
end
def show
@user = User.find(params[:id])
end
end
And I have created new show.html.rb file with lines:
<%= @user.name %>, <%= @user.email %>
But when I’m deploying to heroku I get this info, and I can’t see that page.
heroku[router]: at=info method=GET path=/users/1
Is there some solution for this, or I have done something wrong?
Are you sure the user with
id=1exists on heroku ? If so, did you use ?This command brings up the rails console in production environment. In it, did you do something like that?
And did you know that
yourapp.domain/users/1points to the user record withid=1and not the first record in your database.