Home>

Please write your question in detail here.
(Example) I am making a ●● system with PHP (CakePHP).
The following error message occurred while implementing the ■■ function.

User.create! (name: 'admin', email: '[email protected]', password: 'password', password_confirmation: 'password', admin: true)</code></pre >
<strong>Error message</strong>
<pre><code data-language = "terminal">ActiveModel :: UnknownAttributeError: unknown attribute 'admin' for User.
from /Users/user/rails/taskleaf/vendor/bundle/ruby/2.6.0/gems/activemodel-5.2.3/lib/active_model/attribute_assignment.rb:53:in `_assign_attribute '
Applicable source code
Rails.application.routes.draw do
  namespace: admin do
    resources: users
  end
  root to: 'tasks # index'
  resources: tasks
  get '/ login', to: 'sessions # new'
  post '/ login', to: 'sessions # create'
  delete '/ logout', to: 'sessions # destroy'
end

app/controllers/admin/users_contriller.rb

class Admin :: UsersController</pre>
<strong>schema.rb</strong>
<pre><code># This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema.If i need to create the application database on another
# system, you should be using db: schema: load, not running all the migrations
# from scratch.The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord :: Schema.define (version: 2019_11_28_035704) do
  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"
  create_table "tasks", force:: cascade do | t |
    t.string "name", limit: 30
    t.text "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.bigint "user_id", null: false
    t.index ["user_id"], name: "index_tasks_on_user_id"
  end
  create_table "users", force:: cascade do | t |
    t.string "name", null: false
    t.string "email", null: false
    t.string "password_digest", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["email"], name: "index_users_on_email", unique: true
  end
end
$bundle list | grep bcrypt
  * bcrypt (3.1.13)
Supplemental information (FW/tool version etc.)

Please provide more detailed information here.