We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5398c5a commit 334c844Copy full SHA for 334c844
lib/active_admin/globalize3/filter_empty_translations.rb
@@ -32,7 +32,11 @@ module FilterEmptyTranslations
32
# This filter removes all empty and unsaved translations from params
33
# and marks empty and saved translation for deletion.
34
def filter_empty_translations
35
- model = controller_name.singularize.to_sym
+ model_class = controller_name.classify.safe_constantize
36
+ if model_class.nil? or not model_class.translates?
37
+ return
38
+ end
39
+ model = controller_name.singularize.to_sym
40
params[model][:translations_attributes].each do |t|
41
if !(t.last.map { |_, v| v.empty? ? true : false }[2..-1]).include?(false)
42
if t.last[:id].empty?
0 commit comments