hotwired / turbo-rails

Use Turbo in your Ruby on Rails app
https://turbo.hotwired.dev
MIT License
2.07k stars 320 forks source link

Broadcasts won't render partials if ApplicationController is an API controller #289

Closed szechyjs closed 2 years ago

szechyjs commented 2 years ago

If the main ApplicationController inherits from ActionController::API it prevents the Broadcast#render_format method from working, it will always return " ".

https://github.com/hotwired/turbo-rails/blob/main/app/channels/turbo/streams/broadcasts.rb#L86

It would be nice if the base controller for broadcasts were configurable.

dhh commented 2 years ago

Having ApplicationController inherit from ActionController::API is only intended for apps that don't do any rendering at all. Could see clarifying this as a doc item, but don't think we want to support the anti pattern of making that configurable.