Reputation: 2081
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?
Upvotes: 2
Views: 744
Reputation: 2081
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.
Upvotes: 4