Skip to content

Commit

Permalink
Use a HashWithIndifferentAccess to contain configuration data
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Sep 30, 2022
1 parent ab71d7f commit 88b3978
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/blacklight/configuration/fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Fields
def define_field_access(key, base_class_name = nil, class: nil)
key = key.to_s if respond_to? :to_s

default_values[key.pluralize.to_sym] = ActiveSupport::OrderedHash.new
default_values[key.pluralize.to_sym] = ActiveSupport::HashWithIndifferentAccess.new

@field_type_for_class ||= {}
@field_type_for_class[key] = binding.local_variable_get(:class) || base_class_name
Expand Down
14 changes: 7 additions & 7 deletions spec/models/blacklight/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
end

it "has ordered hashes for field configuration" do
expect(config.facet_fields).to be_a_kind_of ActiveSupport::OrderedHash
expect(config.index_fields).to be_a_kind_of ActiveSupport::OrderedHash
expect(config.show_fields).to be_a_kind_of ActiveSupport::OrderedHash
expect(config.search_fields).to be_a_kind_of ActiveSupport::OrderedHash
expect(config.show_fields).to be_a_kind_of ActiveSupport::OrderedHash
expect(config.search_fields).to be_a_kind_of ActiveSupport::OrderedHash
expect(config.sort_fields).to be_a_kind_of ActiveSupport::OrderedHash
expect(config.facet_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
expect(config.index_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
expect(config.show_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
expect(config.search_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
expect(config.show_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
expect(config.search_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
expect(config.sort_fields).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess
end
end

Expand Down

0 comments on commit 88b3978

Please sign in to comment.