full error messages rails

class UsersController < ApplicationController
  def show
    @user = User.find(params[:id])
  end
end
# routes.rb
Rails.application.routes.draw do
  resources :users
end
# show.html.erb
<%= @user.name %>
# user.rb
class User < ApplicationRecord
end
# Error Message:
# ActiveRecord::StatementInvalid in UsersController#show
# SQLite3::SQLException: no such column: users.name: SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? OFFSET ?

Explanation: 1. In the UsersController, there is a "show" action that attempts to find a user by their ID using User.find(params[:id]).

  1. In the routes.rb file, there is a resources declaration for users, which creates RESTful routes, including the show route for displaying a single user.

  2. In the show.html.erb view, it tries to display the name of the user using <%= @user.name %>. This assumes that there is a "name" column in the "users" table.

  3. In the User model (user.rb), there is no specific mention of a "name" attribute. ActiveRecord automatically assumes the presence of attributes based on the columns in the associated database table.

  4. The error message indicates an ActiveRecord::StatementInvalid error, specifically a SQLite3::SQLException. The message states that there is no such column as "name" in the "users" table when trying to execute the SQL SELECT statement.

To resolve the issue, either add a "name" column to the "users" table using a database migration or update the view to display an existing attribute present in the "users" table.