I am trying to use render html: to render raw html from a controller action:
class SomeController < ApplicationController
def raw_html
render html: '<html><body>Some body text</body></html>'
end
end
However, when I run this controller action, I get a "Template missing" error message
I don't want to use a template, just render raw html.
The error I am getting is:
Processing SomeController # raw_html as HTML Parameters: {} ActionView :: MissingTemplate (missing some_controller / raw_html template with {: locale => [: en] ,: formats => [: html] ,: handlers => [: erb ,: builder ,: raw ,: ruby]}. Search: * "/ Users / doved / source / sample_app / app / views" * "/Users/doved/.rvm/gems/ ruby-2.0.0-p353@syp / gems / chameleon-0.2.4 / app / views "*" /Users/doved/.rvm/gems/ ruby-2.0.0-p353@syp /gems/kaminari-0.15.1/app/views "): app / controllers / some_controller.rb: 14: in call 'raw_html'
lib/middleware/cors_middleware.rb:8:in
I am using Rails 4.0.2
What am I doing wrong?
source
share