Skip to content

Serializer pulls relations when belongs_to declared but not included #1552

@youroff

Description

@youroff

Expected behavior vs actual behavior

As long as belongs_to relationship is not declared in include parameter, it shouldn't be loaded during serialization. Currently it's loaded.

Steps to reproduce

class MembershipSerializer < ActiveModel::Serializer
  attributes :id, :position

  belongs_to :organization
  belongs_to :user
end

And in controller:

respond_with @memberships, meta: meta_data

Environment

ActiveModelSerializers 0.10.0.rc4
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
Rails 4.2.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions