lib/restpack_serializer/serializable.rb in restpack_serializer-0.5.1 vs lib/restpack_serializer/serializable.rb in restpack_serializer-0.5.2
- old
+ new
@@ -69,10 +69,10 @@
data[:links] ||= {}
foreign_key_value = model.send(association.foreign_key)
if foreign_key_value
data[:links][association.name.to_sym] = foreign_key_value.to_s
end
- elsif association.macro == :has_many && association.options[:through]
+ elsif association.macro == :has_many
ids = model.send(association.name).pluck(:id).map { |id| id.to_s }
data[:links] ||= {}
data[:links][association.name.to_sym] = ids
end