rails g active_admin:resource user
And
class DeviseCreateUsers < ActiveRecord::Migration[6.0]
def change
create_table :users do |t|
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
t.string :reset_password_token
t.datetime :reset_password_sent_at
t.datetime :remember_created_at
t.timestamps null: false
end
add_index :users, :email, unique: true
add_index :users, :reset_password_token, unique: true
end
end
According to the columns of the users table
ActiveAdmin.register User do
permit_params :email, :reset_password_token, :reset_password_sent_at, :remember_created_at
end
And write permit_params When I pressed the user creation button after filling out the form, I could not create a user.
So I rewrote user.rb following admin_users.rb
ActiveAdmin.register User do
permit_params :email, :password, :password_confirmation
index do
selectable_column
id_column
column :email
column :current_sign_in_at
column :sign_in_count
column :created_at
actions
end
filter :email
filter :current_sign_in_at
filter :sign_in_count
filter :created_at
form do |f|
f.inputs do
f.input :email
f.input :password
f.input :password_confirmation
end
f.actions
end
end
The display changes as follows You have created a user!