Pages now showing after pushing to heroku - ruby-on-rails

I've succesfully submitted my app to git, and then pushed it to heroku. Starting page working as it has to, but the rest with path heroku_site.com/pages/page_name says me "We're sorry, but something went wrong." Same pages works fine on local server.
Any ideas whats wrong?
inb4 routes are fine(and rest too, rspec spec/ green)

You can view your Heroku logs with $ heroku logs
Looking at your routs, I'd guess that your page is based on content in your local database that you have not added yet to your production database.
If so, you can either push your local database to production $ heroku db:push
Or you can put that data in a Rails migration or seed it. Or you can go create it in your production app.
In general, to find out what you can do: $ heroku help

Related

Rails Application deployed on Heroku writing to localhost db and redirecting to localhost view

I recently deployed a RoR app to Heroku.
The app loads fine.
I have a 'new' action that creates a new model record via a form submission (POST).
The issue is:
On submit, the controller writes to my local database and redirects to my local view corresponding to the controller action: http://localhost:3000/mycontroller/myview
My production database is empty! Any ideas on what is causing this and the fix?? Why is my remote deployment on Heroku accessing localhost???
I only need production on Heroku.
advTHANXance!
Have you tried
RAILS_ENV=production rails db:create
RAILS_ENV=production rails db:migrate
But if you don't run those two, you will surely get migrate error.
Please provide some details about your error.
1) Check if you have a postgres plugin in heroku console
2) Secondly when you push check if you get any error related to PG .
3) dont forget to do heroku restart --app appname
4) login to heroku using **heroku bash** and then run rails c, then check that what database you are using
for it use the command
ActiveRecord::Base.connection_config
now you will get response like
{:adapter=>ADAPTER_NAME, :host=>HOST, :port=>PORT,
:database=>DB, :pool=>POOL, :username=>USERNAME,
:password=>PASSWORD}
if you see dbname as the name in heroku dashboard database name
if it is same then the database is what you are using is of production.
and for transfer to local,re-check your routes and clear your cache,thats the only reason for it.

heroku: run this app correctly?

I am recently using the rubymine(ruby on rails 4) to create web pages and once I have finished some functions and run correctly,I push my code to heroku, so I can directly run the app on the heroku.
The problem is that every function could run correctly on the heroku just like running it at local except one: There is a link in one page called "calendar" to a calendar function,I can run it correctly at local, but on heroku, it goes wrong saying "we are sorry but something went wrong"
enter image description here
someone can explain to me how could it happen? Is it a bug of the heroku system, like a compatibility issue? I have push my code to heroku and run correctly many times and it won't be wrong in the push process.
here is my heroku link: https://dashboard.heroku.com/apps/clients-to-horse
Sugession
I will recommend you, please run your application on local in production mode(environment) after assets precompile, if everything will work properly then I am sure on Heroku will run also.
After deploy on Heroku make sure for migration and assets precompile for Heroku.
You are saying error as "we are sorry but something went wrong", this always comes when we miss something from our side or code bug in the application.

Syncing Heroku and localhost databases

Hey so I am following the One Month Rails guide to learning Ruby and I have hit a wall on one of the lessons. I have just finished uploading an image with Paperclip, and as I finished my work on my localhost and checked it on Heroku, something went wrong. The pin/image appears to have been pushed to my Heroku account, the only problem is that the username and password that works for my localhost:3000 won't work for my Heroku account. The same password should work for both, but for some reason something is wrong. I wish I could give you the action that is going on in my terminal, but the ruby rails is the only thing that has a continuous status flow. The problem may have been when I switched my password after not using my account on localhost for a few weeks, but i thought that once i "git pushed" that to heroku master, it would've synced. I have tried heroku run rake db:setup which didn't seem to do too much as well as wrestled by way through "Importing a Heroku Postgres Database with PG Backups", but I had some trouble working through that. Any ideas? Thanks for the help.
Your 'database.yml' should not be sent to Heroku, they take care of that, creating a new database.yml config file with the proper DB access details.
Try logging into your Heroku instance and deleting the file.
Edit: nevermind, assumed you were not able to connect to the DB, not to login into the website.
So if I'm understanding you correctly, you've deployed your application to Heroku and the login (to your application) that was working locally doesn't work on Heroku.
Deploying your application doesn't deploy data. Assuming you've run heroku run rake db:migrate then your database schemas will at least match.
At this point, you've got a couple of options.
Use a seeds.rb file which you can load with heroku run db:seed to setup some 'seed' data so that you can login.
Push your local database to Heroku - either via heroku db:push or using heroku pg:transfer provided by https://github.com/ddollar/heroku-pg-transfer
Use heroku run console to create your user account via the command line
User.create(email: 'someemail.com', password: 'somepassword', password_confirmation: 'somepassword')
I'd be inclined to go with the later option.
How did the user get in their in the first place? Perhaps going back to that step in the tutorial - just remember, if you are using rails console locally to use heroku run console on Heroku.

Rails/Heroku : db:push runs correctly but does not create the DB

I've been having problems yesterday with Heroku shared Postgres DB. It looks like my db is not correctly 'pushed' to my heroku DB.
Configuration
Using 'pg' gem for both development and production environments.
Using Heroku's 'shared-database' add-on.
Running Rails 3.1.1.
What I'm trying to do
Push my source code to Heroku and then synchronize my postgres DB with Heroku's one. No problem for the source itself, but I can't get my DB up and running.
What I've tried so far
1: Source code push : git push heroku master. OK. This works.
2: Then I try to run : heroku db:push. Seems to be running normally, no error, the schema is sent to Heroku, the different tables are correctly detected and seem to be sent as well :
3: Let's check it out, is everything allright ? heroku info :
Doh ! The database is still empty (and therefore I get DB-related errors when accessing dynamic pages). Can't understand what's happening, I've spent time on this issue yesterday evening but only been mpessing with Heroku for a little while and never encountered this issue. Any clues ?
I'm not convinced that the Database size figure is a live figure. Here's a clean deployment of an app to Heroku and the output of heroku info at each stage. The first run is post application creation, the second after a push of the code, the third after a heroku db:push.
The database was uploaded before the third output and the application is running however the DB:size is not reporting the figure.
Is your application actually erroring because the database isn't present?
The problem is in the commit process.
You should run manually after each commit from your console :
heroku run rake db:migrate
Enjoy
daniel

Heroku: Deploying rails application troubles

I'm trying to deploy my rails application with heroku (as shown here). I've created a very simple rails application (using ruby 1.9.2 and rails 3.0.3; i'm sure heroku supports these - see heroku docs), created and pushed github repo, created heroku repo and pushed it (all commiting is done). And when i'm trying to access my application controller, it throws 404 rails page like it's saying 'there is no such controller'. I've done heroku rake db:migrate but first time i ran it i got 'host not found' error. Running this again fixed that. Well, i'm not sure if i should run heroku addons add:postgresql - i though postgres is on by default, but heroku says i should pay in order to get DB (running command i've mentioned asks me to confirm billing it).
May be it sounds stupid, but how can i deploy my rails application (it's a very simple one) without paying any fees and such troubles as 404 pages like i mentioned in the beginning of my post? (and this is my question). Maybe i should choose other hosting (if it exists in our world) or am i doing something wrong with heroku?
You forgot to push your quotes_controller.rb to git and heroku probably.
git add controllers/quotes_controller.rb
it seems you forgot models also, and probably lot of files.

Resources