ユーザーが性別を持つレールアプリを持っています。これは列挙型で、0 は女性を意味し、1 は男性を意味します。
user_dashboard.rb に次のコードがあります。
require "administrate/base_dashboard"
class UserDashboard < Administrate::BaseDashboard
ATTRIBUTE_TYPES = {
posts: Field::HasMany,
id: Field::Number.with_options(searchable: false),
email: Field::String.with_options(searchable: true),
password: Field::String.with_options(searchable: false),
password_confirmation: Field::String.with_options(searchable: false),
encrypted_password: Field::String.with_options(searchable: false),
reset_password_token: Field::String.with_options(searchable: false),
reset_password_sent_at: Field::DateTime.with_options(searchable: false),
remember_created_at: Field::DateTime.with_options(searchable: false),
first_name: Field::String.with_options(searchable: false),
last_name: Field::String.with_options(searchable: false),
gender: Field::Text.with_options(searchable: false),
type: Field::String.with_options(searchable: false),
created_at: Field::DateTime.with_options(searchable: false),
updated_at: Field::DateTime.with_options(searchable: false),
phone: Field::String.with_options(searchable: false),
}.freeze
COLLECTION_ATTRIBUTES = %i[
posts
email
phone
type
].freeze
SHOW_PAGE_ATTRIBUTES = %i[
posts
id
email
phone
first_name
last_name
gender
type
created_at
updated_at
].freeze
FORM_ATTRIBUTES = %i[
posts
email
phone
first_name
last_name
gender
password
password_confirmation
type
].freeze
COLLECTION_FILTERS = {}.freeze
end
のビューnew_admin_user_path
は次のとおりです。
ユーザーを作成できるのは管理者だけですが、「男性」や「女性」などの性別を手入力する必要があります。administrate gem で動作する選択メニューまたはラジオ ボタンを統合する方法はありますか?