module Ransack::Translate
def association(key, options = {})
def association(key, options = {}) unless context = options.delete(:context) raise ArgumentError, "A context is required to translate associations" end defaults = if key.blank? [:"ransack.models.#{i18n_key(context.klass)}", :"#{context.klass.i18n_scope}.models.#{i18n_key(context.klass)}"] else [:"ransack.associations.#{i18n_key(context.klass)}.#{key}"] end defaults << context.traverse(key).model_name.human options = { :count => 1, :default => defaults } I18n.translate(defaults.shift, **options) end