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.
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
SampleApp
Ruby on Rails Tutorial Sample App \ About
About Us
Ruby on Rails Tutorial
is a project to make a book and screencaste to teach web
development
with Ruby on Rails>. This
is
the sample application for the tutorial.
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//home to view your page
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?
This is the home page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application
</p>
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:
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.