Index.html.erb

Hi Everyone,

A newbie question, I have my subdomain pointing to th respective
app/views folder however the browser does not default to the
index.html.erb , so instead I just have file listing. When I click on
the index.html.erb it does work fine. What do I need to do to get it to
work so it automatically load when a user goes to that view folder.

Thanks in advance

Using ROR 2.2

You should not be directly accessing your views from the browser.
Instead, your subdomain should go to the public folder (instead of app/
views). Here’s the basic flow for a Rails app:

The browser goes to the public folder. The dispatcher in that folder
(automatically generated with the rest of the Rails app) will be
called and given the URL of the browser’s request. Assuming the URL
isn’t for some static file within the public folder (e.g. an image or
CSS file), the dispatcher will route the request to an action within a
controller. It decides which controller and action to go to based on
the URL. Be default, “subdomain.yoursite.com/apple/orange” will call
the apple controller and the orange action.

Inside the controller file, a method with the same name as the
specified action will be run. So in the previous example, the orange
method will be called in the app/controller/apple_controller.rb file.
Once the orange method has finished executing, Rails will then render
app/views/apple/orange.html.erb.

If that isn’t working, you probably have to either set up FastCGI or
start up a WEBrick or Mongrel server. Let us know what your setup is
and we can probably help you out there.

– Andrew

On Apr 12, 2:41 pm, Jump J. [email protected]