0
class ApplicationController < ActionController::Base
    def hello
        render html: 'Hello World!'
    end
end

I have this defined in my application_controller.rb file and I'm just trying to figure out what the "html: 'Hello World!'" syntax is. Is this like a hash passed to the render method?

Mark
  • 153
  • 2
  • 7

1 Answers1

0

It’s html that gets shown to the user when they go to that specific route. For your instance it might be something like /hello. To answer your question yes it’s a hash and you can render other options such as JSON and XML.

You can check out the api docs for all the different options and syntax https://apidock.com/rails/ActionController/Base/render

user1524652
  • 41
  • 1
  • 4