Syl
Syl

Reputation: 3829

Rails with turbo stream do not find the view matching the controller

I am on rails 7 with turbo-rails installed.

The controller call : Processing by AdminController#show as TURBO_STREAM

The controller :

  def show
    respond_to do |format|
      format.turbo_stream do 
        Rails.logger.debug 'IN THE TURBO STREAM FORMAT'
      end
    end
  end

The view is in show.turbo-stream.html.slim (I tested without turbo-stream, same error)

error:

ActionController::UnknownFormat - AdminController#show is missing a template for this request format and variant.
request.formats: ["text/vnd.turbo-stream.html", "text/html"]
request.variant: []:

Upvotes: 1

Views: 908

Answers (1)

zhisme
zhisme

Reputation: 2800

You cannot use show.turbo-stream.html.slim triple extensions like so.

It is either show.turbo-stream.html or show.turbo-stream.slim
In your case both will work, but you need to modify your template according to the chosen extensions in order to be parsed, so either html or slim, not both.

Upvotes: 1

Related Questions