2

I have admin.html in my views folder. How do I get to render it by

get '/admin/?' do
    require_logged_in
    send_file 'views/admin.html' //??
end

but even while following "How to render a plain HTML file with Sinatra?", I end up with the text of the markup, not the rendered HTML. How do I load a view from here?

Secondly, is it "the right thing to do" to put my views there, I mean I feel that it shouldn't be put in the public folder, I've tried putting admin.html in the public folder and I am able to render it just fine. Should I put this in the views folder or the public folder?

Community
  • 1
  • 1
Daryll Santos
  • 2,031
  • 3
  • 22
  • 40
  • Big hint when writing text for the web or a question on SO: Don't say "this" for anchor text in a link. Use the title of the page or paragraph, or something descriptive. Links to Stack Overflow pages will render correctly so just wrap them in double-quotes. – the Tin Man Sep 21 '13 at 18:01

1 Answers1

4

I solved it. It turns out that I had

content_type :json

up in a before block. I added content_type "html", everything's good now.

matt
  • 78,533
  • 8
  • 163
  • 197
Daryll Santos
  • 2,031
  • 3
  • 22
  • 40