Reputation: 11042
I realise this is a very common question but I am currently teaching myself ruby on rails and after going through the gargantuan task of getting an app set up on Heroku I've encountered my first problem.
I thought something was broken since when I click the About your application's environment
link I get the page not found error
but read that's ok as that should only work in the dev environment.
So, I went ahead and created a controller and a view with the following command:
rails generate controller Index
In my app > controllers
folder I have a file called index_controller.rb
which contains the following:
class IndexController < ApplicationController
def index
end
end
and in my app > views > index
folder I have a file named index.html.erb
<html>
<head>
<title>Test Site</title>
</head>
<body>
<h1>Test</h1>
</body>
</html>
But when I visit http://safe-peak-2383.herokuapp.com/index/index/ I get the page not found error.
Since I'm using Heroku my gem file contains this:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Any ideas?
Upvotes: 2
Views: 2644
Reputation: 6852
If you visit http://safe-peak-2383.herokuapp.com you will see the getting started page. I seems like you have not set the root route for your app.
first,
git rm public/index.html
This will get rid of the getting started page when you visit the root path of your app
next, in config/routes.rb
root to: 'index#index'
This will make http://safe-peak-2383.herokuapp.com show the index of your index controller.
Remember to push all these changes to github then heroku for them to take effect
Upvotes: 1