Is it possible implements HAML to a Rails Project in API Mode?

74 Views Asked by At

How can I connect HAML templates on my controllers?

I am using Rails 7 in API Mode and I want to return one HTML template on my application

P.D: I am including ActionController::Base, because Rails in FullStack mode uses ActionController::Base to returning HTML templates

# app/views/tickets/ticket.html.haml

%strong= Hello World
# app/controllers/tickets_controller.rb

class TicketsController < ActionController::Base
  def index
    # (return HAML template here)
  end
end
1

There are 1 best solutions below

0
Javier On

I resolve the problem! Just I do this:

# app/controllers/tickets_controller.rb

class TicketsController < ActionController::Base
  def index
    render 'tickets/index'
  end
end

Just I render it as a HTML template almost like FullStack Mode