문제

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top