Skip to content

Commit

Permalink
Merge pull request #1218 from coreyaus/patch-2
Browse files Browse the repository at this point in the history
Fix :default option in Translate.attribute method
  • Loading branch information
scarroll32 authored Mar 31, 2021
2 parents 15b2dc6 + 91a97e2 commit 0bd4afe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ransack/translate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def attribute(key, options = {})
defaults = base_ancestors.map do |klass|
"ransack.attributes.#{i18n_key(klass)}.#{original_name}".to_sym
end
defaults << options.delete(:default) if options[:default]

translated_names = attribute_names.map do |name|
attribute_name(context, name, options[:include_associations])
Expand All @@ -48,7 +49,6 @@ def attribute(key, options = {})
defaults << "%{attributes}".freeze
end

defaults << options.delete(:default) if options[:default]
options.reverse_merge! count: 1, default: defaults
I18n.translate(defaults.shift, **options.merge(interpolations))
end
Expand Down

0 comments on commit 0bd4afe

Please sign in to comment.