I fixed it with the following code:
get :show, :map => "/v1.0/crit_admin/" do
content_type 'text/html'
render "shared/home", :layout => false
end
Вопрос
I'm trying to render an ERB template named "home.erb" in the folder "app/views/shared/". This is the code in my controller:
get :show, :map => "/v1.0/crit_admin/", :provides => [:html] do
render "shared/home", :layout => false
end
Whenever I try to go to the page, I see the HTML on the page, not the page itself.
Looking at the network event, it's registering the content type as "application/json". The source reveals that everything is wrapped in <pre>
tags.
What's going on here? How can I get the page to actually be rendered?
Решение
I fixed it with the following code:
get :show, :map => "/v1.0/crit_admin/" do
content_type 'text/html'
render "shared/home", :layout => false
end