Question

I'm very new to ROR and very impressed so far, its extremely fast and structured well. I've been taught to use the command.

rails generate controller Welcome index

I understand it so far as.. create me a non-db-driven page in a sub-directory.. so the above would be:

localhost:3000/welcome/index

but what if I want my domain www.something.com (localhost:3000) to be the homepage?

As in (for a normal site) putting a index.html in the root.

is this possible, is there a reason I cant find the answer anywhere?

Thank you in advance.

Was it helpful?

Solution

You can make the index action of the welcome controller the homepage:

# config/routes.rb
root to: 'welcome#index'

See the documentation for more information.

OTHER TIPS

Rails 3.x

To set homepage add following line to the end of the routes.rb file:

 root :to => "welcome#index"

and delete public/index.html.erb.

Please also note that welcome#index corresponds to index action in a WelcomeController

Rails 4

 root 'welcome#index'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top