Reputation: 1608
I am brand spankin new to ruby and rails. I've gone through the rails for zombies tutorial and a couple others.
I generated a default rails app using the tools on my web host.
I got rails wired to a database and am able to display a page with values from it.
From all my searching I believe that just naming my view files *.html.erb should be enough to make them render with a mime type for html.
The problem is the page shows up with a Content-Type: text/plain.
Here's what I have
config/routes.rb
ActionController::Routing::Routes.draw do |map|
map.resources :enrollapplications
end
app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
end
app/controllers/enrollapplications_controller.rb
class EnrollapplicationsController < ApplicationController
def show
@enrollapp = Enrollapplication.find(params[:id])
end
end
app/views/layouts/application.html.erb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Enrollment Application</title>
<%= csrf_meta_tag %>
</head>
<body>
<%= yield %>
</body>
</html>
app/views/enrollapplications/show.html.erb
<h3>show stuff</h3>
<h1><%= @enrollapp.firstName %></h1>
curl -I example.com/Application/enrollapplications/1
HTTP/1.1 200 OK
Date: Sun, 28 Jul 2013 17:37:36 GMT
Content-Type: text/plain
Feel free to point and laugh at my mistakes.
Upvotes: 1
Views: 828
Reputation: 1608
The Linux admin for my host said they are running a version of Mongrel where this is a known bug.
He put a newer version of mongrel.rb in my /config/initializers and that solved the problem.
Upvotes: 0