Ruby on rails 控制活动管理编辑页面上字段的顺序
如何控制活动管理编辑页面上字段的显示顺序?要自定义视图页面,我已使用以下内容更新了管理员/模型文件:Ruby on rails 控制活动管理编辑页面上字段的顺序,ruby-on-rails,activeadmin,Ruby On Rails,Activeadmin,如何控制活动管理编辑页面上字段的显示顺序?要自定义视图页面,我已使用以下内容更新了管理员/模型文件: ActiveAdmin.register Church do menu :priority => 2 scope :inactive scope :unregistered scope :active scope :registered show do attributes_table :name, :address1, :address2, :city,
ActiveAdmin.register Church do
menu :priority => 2
scope :inactive
scope :unregistered
scope :active
scope :registered
show do
attributes_table :name, :address1, :address2, :city, :state, :zip, :office_phone,
:fax, :email1, :active, :registered
end
但是,将“显示”更改为“编辑”或“新建”会导致无方法错误。只需更改
属性表中项目的顺序即可,ActiveAdmin将使用该顺序进行显示
更新:对于编辑页面
form do |f|
f.inputs "Label" do
f.input :name
f.input :address1
# etc
end
end
只需更改attributes\u表中项目的顺序
,ActiveAdmin将使用该顺序进行显示
更新:对于编辑页面
form do |f|
f.inputs "Label" do
f.input :name
f.input :address1
# etc
end
end
谢谢你的回复。我还是缺少一些东西。使用上面的代码,“show”表单确实按照与“attributes_table”相同的顺序显示字段。“编辑”表单以不同的顺序显示。@rick抱歉,我没注意到您询问的是“编辑”页面。您需要更改表单do | f | end
,将f.input
按您想要的顺序放入其中。Sorensen,是的,就是这样。再次感谢您的帮助。索伦斯-谢谢您的回复。我还是缺少一些东西。使用上面的代码,“show”表单确实按照与“attributes_table”相同的顺序显示字段。“编辑”表单以不同的顺序显示。@rick抱歉,我没注意到您询问的是“编辑”页面。您需要更改表单do | f | end
,将f.input
按您想要的顺序放入其中。Sorensen,是的,就是这样。再次感谢你的帮助。