Skip to content

Conflict with send_data responses and lack of global max_depth configuration #25

@MordechaiWein

Description

@MordechaiWein

Issue
Transmutation currently overrides render globally, which causes conflicts when using non-JSON responses such as send_data.

Example:

class Api::ConversionsController < ApplicationController
  def create
    send_data pdf, type: 'application/pdf'
  end
end

When transmutation is loaded, this triggers the serializer override instead of sending the PDF data.

Expected behavior
send_data, send_file, and similar Rails methods should bypass Transmutation’s render override.

Global max_depth configuration
max_depth should be configurable globally (e.g., via an initializer) or default to 2. Most APIs need at least two nested levels, and repeating max_depth: 2 in every render call adds noise and reduces practicality.

Environment

  • Ruby version: 3.3.x
  • Rails version: 7.2.x
  • Transmutation version: (latest as of Oct 2025)

Thank you
This gem is fantastic, I love that it keeps the elegance of render json: while solving AMS’s depth issues. Would love to keep using it once this bug is addressed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions