活动管理员字段上的布尔值 returns 为空而不是 false(Rails 3.2/活动管理员)
Boolean on active admin field returns empty instead false (Rails 3.2/Active Admin)
我有一个名为 User 的表单,它具有一个名为 'confirmed' 的布尔属性。当我显示所有用户或尝试查看每个用户时,确认值始终为空而不是 false 并且我已经搜索了很多但我仍然不明白为什么会这样。谁能帮帮我?
注:'confirmed'只有为false才会显示为空
架构迁移:
create_table "users", :force => true do |t|
t.string "name"
t.boolean "confirmed", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
活动管理员的索引函数和表单:
ActiveAdmin.register User do
index do
column :id
column :name
column :confirmed
actions
end
form do |f|
f.inputs "User Details" do
f.input :name
f.input :confirmed
end
f.actions
end
end
ActiveAdmin.register User do
index do
column :id
column :name
column :confirmed do |user|
user.confirmed ? "confirmed" : "unconfirmed"
end
# or, but maybe only in 1.x versions
column :confirmed do |user|
status_tag user.confirmed
end
actions
end
form do |f|
f.inputs "User Details" do
f.input :name
f.input :confirmed
end
f.actions
end
end
我有一个名为 User 的表单,它具有一个名为 'confirmed' 的布尔属性。当我显示所有用户或尝试查看每个用户时,确认值始终为空而不是 false 并且我已经搜索了很多但我仍然不明白为什么会这样。谁能帮帮我?
注:'confirmed'只有为false才会显示为空
架构迁移:
create_table "users", :force => true do |t|
t.string "name"
t.boolean "confirmed", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
活动管理员的索引函数和表单:
ActiveAdmin.register User do
index do
column :id
column :name
column :confirmed
actions
end
form do |f|
f.inputs "User Details" do
f.input :name
f.input :confirmed
end
f.actions
end
end
ActiveAdmin.register User do
index do
column :id
column :name
column :confirmed do |user|
user.confirmed ? "confirmed" : "unconfirmed"
end
# or, but maybe only in 1.x versions
column :confirmed do |user|
status_tag user.confirmed
end
actions
end
form do |f|
f.inputs "User Details" do
f.input :name
f.input :confirmed
end
f.actions
end
end