diff --git a/lib/administrate/base_dashboard.rb b/lib/administrate/base_dashboard.rb index 4bec71b04b..4b05404ce0 100644 --- a/lib/administrate/base_dashboard.rb +++ b/lib/administrate/base_dashboard.rb @@ -118,10 +118,10 @@ def item_includes def item_associations attributes = if show_page_attributes.is_a?(Hash) - show_page_attributes.values.flatten - else - show_page_attributes - end + show_page_attributes.values.flatten + else + show_page_attributes + end attribute_associated attributes end diff --git a/spec/example_app/app/dashboards/order_dashboard.rb b/spec/example_app/app/dashboards/order_dashboard.rb index 0b45f16431..3aba480019 100644 --- a/spec/example_app/app/dashboards/order_dashboard.rb +++ b/spec/example_app/app/dashboards/order_dashboard.rb @@ -36,24 +36,22 @@ class OrderDashboard < Administrate::BaseDashboard ] FORM_ATTRIBUTES = { - "" => [ - :customer, + "" => %i[customer], + "details" => %i[ + line_items + shipped_at + payments ], - "details" => [ - :line_items, - :shipped_at, - :payments, + "address" => %i[ + address_line_one + address_line_two + address_city + address_state + address_zip ], - "address" => [ - :address_line_one, - :address_line_two, - :address_city, - :address_state, - :address_zip, - ], - } + }.freeze SHOW_PAGE_ATTRIBUTES = FORM_ATTRIBUTES.merge( "" => %i[customer created_at updated_at], "details" => %i[line_items total_price shipped_at payments], - ) + ).freeze end diff --git a/spec/lib/pages/form_spec.rb b/spec/lib/pages/form_spec.rb index 3d76bef0b9..8dc13ce919 100644 --- a/spec/lib/pages/form_spec.rb +++ b/spec/lib/pages/form_spec.rb @@ -37,10 +37,10 @@ it "returns the attributes from FORM_ATTRIBUTES_NEW" do expect(attributes).to match( - { "" => %i[ + "" => %i[ order product - ] }, + ], ) end end @@ -50,11 +50,11 @@ it "returns the attributes from FORM_ATTRIBUTES_EDIT" do expect(attributes).to match( - { "" => %i[ + "" => %i[ order product quantity - ] }, + ], ) end end