Correct bug with association moderation
`TheModerator::Model` is not included in every `ActiveRecord` model so it has to be included in association models if it is not when moderating associations.master
parent
168fc7b9db
commit
2b429681d0
|
@ -69,6 +69,7 @@ module TheModerator
|
||||||
assoc_fields = data[:data]
|
assoc_fields = data[:data]
|
||||||
assoc_fields_display = data[:data_display]
|
assoc_fields_display = data[:data_display]
|
||||||
else
|
else
|
||||||
|
objects.class.send(:include, TheModerator::Model) unless objects.respond_to?(:moderation_data)
|
||||||
data = objects.moderation_data(*moderated_attributes)
|
data = objects.moderation_data(*moderated_attributes)
|
||||||
assoc_fields = data[:data].merge(id: objects.id) unless data[:data].empty?
|
assoc_fields = data[:data].merge(id: objects.id) unless data[:data].empty?
|
||||||
assoc_fields_display = data[:data_display] unless data[:data_display].empty?
|
assoc_fields_display = data[:data_display] unless data[:data_display].empty?
|
||||||
|
@ -83,6 +84,7 @@ module TheModerator
|
||||||
tab = []
|
tab = []
|
||||||
|
|
||||||
objects.each do |resource|
|
objects.each do |resource|
|
||||||
|
resource.class.send(:include, TheModerator::Model) unless resource.respond_to?(:moderation_data)
|
||||||
data = resource.moderation_data(*moderated_attributes)
|
data = resource.moderation_data(*moderated_attributes)
|
||||||
|
|
||||||
assoc_fields[resource.id] = data[:data].merge(id: resource.id) unless data[:data].empty?
|
assoc_fields[resource.id] = data[:data].merge(id: resource.id) unless data[:data].empty?
|
||||||
|
|
Loading…
Reference in New Issue