I'm racking my brain trying to get all this straight in my head.
What do the settings need to be in order to show a layout on the
landing page without referencing a controller.
All I want to do is hit www.mypage.com and display a layout view.
right now it's pure html - no data. Everything I read shows
www.mypage.com/somecontroller
You're kinda garbling your jargon here a bit, which is okay.
When you hit http://someurl/ rails looks in the public folder for
index.html. If it finds it, it renders it. If it doesn't, it looks in
the routes.rb file (in the config folder) for a route that is hooked
up to a blank string (ie the root of the site). If it find that, it
grabs that route, runs the action at that route, and then renders the
layout template associated with that action (if there is one - it's
either specified on the controller at the top with the layout method,
or by default it will render views inside a layout with the same name
as the controller, if it finds one and the layout is not specified in
the controller), inserting in the results of the rendered view file
template into that layout for each time it finds <%= yield %> in the
layout.
If it can't find the view file, it will complain.
I hope this helps.
Julian.
Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #4 coming soon!
http://sensei.zenunit.com/
class MainController < ApplicationController
def index
# will render app/views/main/index.html.erb
end
end
...and if you have the file app/views/main/index.html.erb, you should
be getting something. If not, please paste the whole error. Also,
check your logs to see if your request for http://www.myapp.com/ (or
perhaps http://localhost:3000/) is correctly calling the :controller
=> 'main', :action => 'index'.