在 activeadmin 中显示更改的显示页面变量
Show altered variable for show page in activeadmin
ActiveAdmin 中是否有一种方法可以为 show
页面的控制器编辑变量 IE address
,而无需手动浏览并显示所有字段?我有大约 25 个字段,只想隐藏 show
中的地址,这样没有编辑权限的人就看不到它。
我知道我可以自定义显示页面并列出所有变量,但我喜欢它的外观,减去显示地址字段。
我做了一个技巧来隐藏显示块的属性,如下所示:
show do
# the array contains the fields to be hidden in the show table
attributes_table *(AdminUser.column_names.map(&:to_sym) - [:last_sign_in_ip, :sign_in_count])
end
修改解决方案 from this SO question 以隐藏某些字段而不是显示哪些字段。
ActiveAdmin 中是否有一种方法可以为 show
页面的控制器编辑变量 IE address
,而无需手动浏览并显示所有字段?我有大约 25 个字段,只想隐藏 show
中的地址,这样没有编辑权限的人就看不到它。
我知道我可以自定义显示页面并列出所有变量,但我喜欢它的外观,减去显示地址字段。
我做了一个技巧来隐藏显示块的属性,如下所示:
show do
# the array contains the fields to be hidden in the show table
attributes_table *(AdminUser.column_names.map(&:to_sym) - [:last_sign_in_ip, :sign_in_count])
end
修改解决方案 from this SO question 以隐藏某些字段而不是显示哪些字段。