heroku doesnt show my views. RoR project - ruby-on-rails

So I am trying to upload a RoR project I am working on. So to make it more interesting I just changed the home page, instead of having the usual one. I deleted the public/index.html, created a static page controller and added a new home.html.erb file in my views folder. I also changed the config/routes file. It works fine on my localhost. then I run these
git add .
git commit -m "Added home page"
git push heroku master
heroku run rake db:migrate
heroku open
and for a homepage I get the usual RoR page instead of mine. What did I do wrong?

Try deleting public/index.html as that is probably getting served before hitting the app.

Related

Getting a Rails App to Work with Git Pages to Create a Personal Blog

I created a git page -> https://github.com/username/username.github.io.git
I then created a workspace in Cloud9-IDE and cloned https://github.com/username/username.github.io.git
Then I installed Rails from the terminal gem install rails -v 5.0.1
and create a new Rails app rails _5.0.1_ new blog, I created a 'Hello World' home page and confirmed that it was working locally with Rails Server.
I then committed the changes and pushed successfully to GitHub, the commits are visible in the repo.
git add -A
git commit -m "message"
git push
However, when visiting https://username.github.io I do not see anything other than username.github.io from the README at the top of the page.
I'm afraid not. Rails is a dynamic system, meaning that the pages are generated from templates combined with data. Github Pages only servers static HTML, so even if you put static content into Rails, you would not be able to run the scripts that serve it.
If you really need Rails, use Heroku free plan.

Heroku and Rails: App pushes successfully but nothing appears in heroku app

I am trying to learn how to push to Heroku. I created a brand new Rails app using postgresql
rails new p3 -d postgresql
and followed all instructions exactly as they are on herokus help page.
git init
heroku create
git add .
git commit -m "rails new p3 -d postgresql"
git push heroku master
run rake db:migrate
When I perform the heroku opencommand it directs me to a page that says "The page you were looking for doesn't exist". Furthermore, When I check my code under heroku personal apps, the app name shows up but none of the code appears.
I have no idea what to do next. What do I do when my code pushes successfully, but nothing appears in my heroku app?
EDIT:
Activity feed shows I am pushing, but still nothing changed in code:
After checking my logs by typing heroku logs --tail I realized I was receiving an error message because my routes were not setup. Setup a basic get '/' route and it will work correctly.

Heroku open gives a 404

I'm deploying Rails on Heroku for the first time, so I accept I'm a bit of a newbie on this turf.
I installed the tool Heroku tool belt. Created a simple Rails application. Logged into Heroku. did..
heroku Create
And then pushed up the master
git push heroku master
Once the deployment is complete I tried
heroku open
I end up getting a 404. The app though runs fine on my local environment.
Heroku does not provide a standard welcome page for Rails 4. So if you did not create one yourself You will get a 404 page. This problem should not arise if your root to is properly set.
You can test this by creating a home controller with an index action, create the index. html.erb page and define root to: 'home#index'. Now heroku knows about the pageĀ and you will not receive a 404 error.
Getting started with heroku guide: https://devcenter.heroku.com/articles/getting-started-with-rails4

Rails page not showing in Heroku

I deployed a simple Rails project on Heroku and I'm having some trouble. I set my root page as:
root 'landing#index'
This page works fine when I cd into the project, and start rails server and go to localhost:3000. I pushed to Heroku without error using git push heroku master. However now, if I do heroku open, I get the following message on the page:
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
The logs don't show anything significant as well...
Make sure that you have the following:
A LandingController
A view page at the path app/views/landing/index.html.erb
root 'landing#index' on the second line (after Application.routes.draw)
The live repository is up to date
https://devcenter.heroku.com/articles/getting-started-with-rails4#write-your-app
Failing that, run heroku run rake routes. You should see a route like GET /landing/index landing#index and root / landing#index
If they don't appear, add the line resources :landing to generate the default routes for the landing controller.

starting with heroku; fail updating rails app

after a few months learning a bit about rails and making some stuff local, I wanted to try to upload a simple rails app to heroku. Which, by the way, was a pain in the ass because of installing issues of Postgresql. But ok, that's done.
Now I create an app on heroku, I did the login, key thing, git, and uploaded. Was fine, very easy after all. I just uploaded an empty rails app, to try heroku.
Well, then I add a controller. Upload again via git push heroku master and not so fine! I did scaffold, for my articulo controller. And I wasn't able to open the URL once pushed to heroke on someurl/articulos. I got an 404 heroku message here: http://enigmatic-scrubland-8865.herokuapp.com/articulos
Then I create a controller for the home site and get rid of the "welcome aboard" default site. Again push heroku... On terminal I got messages all updated, and lauching. All fine.
But then I access and again, the "welcome aboard" default page.
Locally it works fine. But now I'm not sure if I'm doing it well. It scares me that no failing messages are to see nowhere, but obviously it fails.
After editing my rails app, I always do this:
$ git init
$ git add .
$ git commit -m "init"
$ git push heroku master
Like the documentation says on heroku. But, no error and no updating.
Thanks in advice.
From what I see from heroku devcenter, the git init part is only to be done on the first initial creation of the git repo, not "After editing my rails app".
In other words, you shouldn't have to "always do" a git init after editing your rail apps.
For the first push, I would recommend a:
git push -u heroku master
That way, all the subsequent push will be a simple:
git push

Resources