fix attribute translation for activerecord using STI

This commit is contained in:
andreas 2014-09-12 17:59:11 +03:00
parent a786f5e48b
commit af7f487729
1 changed files with 6 additions and 3 deletions

View File

@ -81,13 +81,16 @@ module Ransack
:"#{associated_class.i18n_scope}.attributes.#{
i18n_key(associated_class)}.#{attr_name}"
else
:"#{context.klass.i18n_scope}.attributes.#{
i18n_key(context.klass)}.#{attr_name}"
context.klass.ancestors.select do |k|
k.respond_to?(:model_name)
end.collect do |k|
:"#{k.i18n_scope}.attributes.#{i18n_key(k)}.#{attr_name}"
end
end
),
:".attributes.#{attr_name}",
attr_name.humanize
]
].flatten
)
defaults = [:"ransack.attributes.#{i18n_key(context.klass)}.#{name}"]
if include_associations && associated_class