Check for CollectionProxy to detect has_many

Rails 4 returns an `ActiveRecord::Associations::CollectionProxy` instead
of just an `Array` for has_many associations.
master
Guillaume Dott 2014-09-23 15:10:01 +02:00
parent 9e2a68d1ae
commit 2ba7f029cd
1 changed files with 1 additions and 1 deletions

View File

@ -64,7 +64,7 @@ module TheModerator
objects = send(assoc)
if respond_to?("#{assoc}_attributes=")
if objects.is_a?(Array)
if objects.is_a?(Array) || objects.is_a?(ActiveRecord::Associations::CollectionProxy)
data = moderate_has_many_association(objects, moderated_attributes)
assoc_fields = data[:data]
assoc_fields_display = data[:data_display]