Skip to content

Commit

Permalink
Pass the class argument to serialize as a keyword
Browse files Browse the repository at this point in the history
The positional argument is deprecated and will be removed in rails 7.2
  • Loading branch information
jcoyne committed Jan 30, 2024
1 parent 58cf6d2 commit 41f68b0
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions app/models/spotlight/blacklight_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ class BlacklightConfiguration < ActiveRecord::Base
has_paper_trail

belongs_to :exhibit, touch: true, optional: true
serialize :facet_fields, Hash, coder: YAML
serialize :index_fields, Hash, coder: YAML
serialize :search_fields, Hash, coder: YAML
serialize :sort_fields, Hash, coder: YAML
serialize :default_solr_params, Hash, coder: YAML
serialize :show, Hash, coder: YAML
serialize :index, Hash, coder: YAML
serialize :per_page, Array, coder: YAML
serialize :document_index_view_types, Array, coder: YAML
serialize :facet_fields, type: Hash, coder: YAML
serialize :index_fields, type: Hash, coder: YAML
serialize :search_fields, type: Hash, coder: YAML
serialize :sort_fields, type: Hash, coder: YAML
serialize :default_solr_params, type: Hash, coder: YAML
serialize :show, type: Hash, coder: YAML
serialize :index, type: Hash, coder: YAML
serialize :per_page, type: Array, coder: YAML
serialize :document_index_view_types, type: Array, coder: YAML

include Spotlight::BlacklightConfigurationDefaults

Expand Down
2 changes: 1 addition & 1 deletion app/models/spotlight/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Contact < ActiveRecord::Base
belongs_to :exhibit, touch: true, optional: true
scope :published, -> { where(show_in_sidebar: true) }
default_scope { order('weight ASC') }
serialize :contact_info, Hash, coder: YAML
serialize :contact_info, type: Hash, coder: YAML

extend FriendlyId
friendly_id :name, use: %i[slugged scoped finders], scope: :exhibit
Expand Down
2 changes: 1 addition & 1 deletion app/models/spotlight/custom_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Spotlight
##
# Exhibit custom fields
class CustomField < ActiveRecord::Base
serialize :configuration, Hash, coder: YAML
serialize :configuration, type: Hash, coder: YAML
belongs_to :exhibit, optional: true

extend FriendlyId
Expand Down
2 changes: 1 addition & 1 deletion app/models/spotlight/custom_search_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Spotlight
# Exhibit-specific custom search fields
class CustomSearchField < ApplicationRecord
serialize :configuration, Hash, coder: YAML
serialize :configuration, type: Hash, coder: YAML
belongs_to :exhibit

def label=(label)
Expand Down
2 changes: 1 addition & 1 deletion app/models/spotlight/exhibit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Exhibit < ActiveRecord::Base
acts_as_tagger
acts_as_taggable
delegate :blacklight_config, to: :blacklight_configuration
serialize :facets, Array, coder: YAML
serialize :facets, type: Array, coder: YAML

# NOTE: friendly id associations need to be 'destroy'ed to reap the slug history
has_many :about_pages, -> { for_default_locale }, extend: FriendlyId::FinderMethods
Expand Down
2 changes: 1 addition & 1 deletion app/models/spotlight/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Resource < ActiveRecord::Base
has_many :solr_document_sidecars
has_many :events, as: :resource

serialize :data, Hash, coder: YAML
serialize :data, type: Hash, coder: YAML

##
# Persist the record to the database, and trigger a reindex to solr
Expand Down
4 changes: 2 additions & 2 deletions app/models/spotlight/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class Search < ActiveRecord::Base
accepts_nested_attributes_for :group_memberships
accepts_nested_attributes_for :groups
if defined?(Blacklight::SearchParamsYamlCoder)
serialize :query_params, Blacklight::SearchParamsYamlCoder, default: -> { {} }
serialize :query_params, coder: Blacklight::SearchParamsYamlCoder, default: -> { {} }
else
serialize :query_params, Hash
serialize :query_params, type: Hash
end
default_scope { order('weight ASC') }
scope :published, -> { where(published: true) }
Expand Down

0 comments on commit 41f68b0

Please sign in to comment.