Reputation: 493
New to rails and I need to make a homepage for my website. I have 3 controllers that will be linked to from the homepage. I don't want to create another controller for the homepage. For example:
I want homepage to be: http://samplepage.com
The homepage will link to: http://samplepage.com/apples http://samplepage.com/bananas http://samplepage.com/carrots
How do I set up the root route? I already have functioning pages for /apples, /banana, /carrots.
Upvotes: 0
Views: 333
Reputation: 4963
Ok, you can use any of your controllers to setup the home page eg:
ApplesController
def home
# intialize instance variable for home page here
end
. . . . .
end
Create view file in app/views/apples/home.html.erb
In your routes
route "apples#home"
Upvotes: 1
Reputation: 2963
Take a look at high_voltage. You will still need to create single controller for your static pages but other than that looks like it what you look for.
Upvotes: 0