Stuff added to my web page

Hi

I started working with the book Ruby on Rails3 about 2 months ago. Going through the sample app was fun and interesting. I had to put it down for a couple of weeks. When I came back to it, I figured that I would just start over. So from the very first part - the addition of a title - new stuff is added to my page, and I have no idea where this is coming from. Here is an example.

The Home.html.erb file

<!DOCTYPE html> <html>   <head>     <title>Ruby on Rails Tutorial Sample App | Home</title>   </head>

  <body>     <h1>Sample App</h1>     <p>       This is the home page for the       <a href="http://railstutorial.org/&quot;&gt;Ruby on Rails Tutorial</a>       sample application     </p>   </body> </html>

Very simple, but when I bring up the view source file of the localhost: 3000/pages/home I get the following. Where is all that extra stuff come from on top and how do I get rid of it?

Thanks

<!DOCTYPE html> <html> <head>   <title>SampleApp</title>   <link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" /> <link href="/assets/pages.css?body=1" media="all" rel="stylesheet" type="text/css" />   <script src="/assets/jquery.js?body=1" type="text/javascript"></

<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></

<script src="/assets/pages.js?body=1" type="text/javascript"></script> <script src="/assets/application.js?body=1" type="text/javascript"></

  <meta content="authenticity_token" name="csrf-param" /> <meta content="XJBbNLStkGBebtN4iJoR1EzvJWX8XA1YgJamnb3EfDc=" name="csrf-token" /> </head> <body>

<!DOCTYPE html> <html>   <head>     <title>Ruby on Rails Tutorial Sample App \ About</title>   </head>

  <body>     <h1>About Us</h1>     <p>       <a href="http://railstutorial.org/&quot;&gt;Ruby on Rails Tutorial</a>       is a project to make a book and screencaste to teach web development       with <a href="http://rubyonrails.org/&quot;&gt;Ruby on Rails></a>. This is the sample application for the tutorial.     </p>   </body> </html>

</body> </html>

Hard to say for sure. If you still have a public/index.html that will get rendered as the default home page. Delete it and you'll get the page defined in routes.rb as the root page.

If you have nothing in routes.rb yet, you'll need to specify localhost:3000/<controller>/home to view your page

Hi

I started working with the book Ruby on Rails3 about 2 months ago. Going through the sample app was fun and interesting. I had to put it down for a couple of weeks. When I came back to it, I figured that I would just start over. So from the very first part - the addition of a title - new stuff is added to my page, and I have no idea where this is coming from. Here is an example.

The Home.html.erb file

<!DOCTYPE html> <html>   <head>     <title>Ruby on Rails Tutorial Sample App | Home</title>   </head>

  <body>     <h1>Sample App</h1>     <p>       This is the home page for the       <a href="http://railstutorial.org/&quot;&gt;Ruby on Rails Tutorial</a>       sample application     </p>   </body> </html>

Very simple, but when I bring up the view source file of the localhost: 3000/pages/home I get the following. Where is all that extra stuff come from on top and how do I get rid of it?

That's coming from the /views/layouts/application.html.erb file. This is how Rails templates usually render. You don't want to get rid of that file, only edit it to remove the extra bits you don't need. Remember though -- you will need the JavaScript stuff if you expect your forms to work, since you won't be able to send a PUT or DELETE request without it.

But more importantly, your home.html.erb should very definitely only be this part:

<h1>Sample App</h1> <p>   This is the home page for the   <a href="http://railstutorial.org/&quot;&gt;Ruby on Rails Tutorial</a>   sample application </p>

Otherwise you will either have to override the normal (convention-based) Rails rendering to remove the template option from every render, or you'll end up with a page-within-a-page monstrosity such as you have now.

Walter