diff --git a/app/models/miq_group.rb b/app/models/miq_group.rb index 3af3f045e1e..4acaa8b1b65 100644 --- a/app/models/miq_group.rb +++ b/app/models/miq_group.rb @@ -43,6 +43,10 @@ def name description end + def settings + super && super.with_indifferent_access + end + def self.with_allowed_roles_for(user_or_group) includes(:miq_user_role).where.not({:miq_user_roles => {:name => user_or_group.disallowed_roles}}) end diff --git a/spec/models/miq_group_spec.rb b/spec/models/miq_group_spec.rb index bddf31a9133..48febe106f2 100644 --- a/spec/models/miq_group_spec.rb +++ b/spec/models/miq_group_spec.rb @@ -312,6 +312,15 @@ ws3 = FactoryGirl.create(:miq_widget_set, :name => 'B2', :owner => group) expect(group.ordered_widget_sets).to eq([ws1, ws3, ws2]) end + + it "works when settings use strings" do + ws1 = FactoryGirl.create(:miq_widget_set, :name => 'A1', :owner => group) + _ws2 = FactoryGirl.create(:miq_widget_set, :name => 'C3', :owner => group) + ws3 = FactoryGirl.create(:miq_widget_set, :name => 'B2', :owner => group) + group.update_attributes(:settings => {"dashboard_order" => [ws3.id.to_s, ws1.id.to_s]}) + + expect(group.ordered_widget_sets).to eq([ws3, ws1]) + end end context ".sort_by_desc" do