views:

273

answers:

3

I am deploying an app on Heroku. Though the experience of deploying is good but I am having pain in fixing stuff.

Very first thing is that autoincrement IDs are all messed up between heroku db and my db. So before deploy I have to delete all data from my local app and then push my DB to heroku. If I don't do that then while trying to add a record on heroku app I get duplicate key errors. Is there a way to control autoincrement ids in rails?

Second thing, when there are errors on heroku app. I see the custom 500 error page. We're sorry, but something went wrong (500). Is there a way to show some sort of error message instead? Or I have to depend on heroku logs for that? This is just for development so if some error happens I'd just like to see it on the page itself. Atleast some part of it...

I'm new to Heroku and Rails

A: 

You might check the Exception Notification plugin to customize how exceptions are handled.

And concerning your db problems, you can push your local database to heroku using heroku db:push

JRL
do I really need a plugin just to show some errors on my 500 page? seems like an overdo. plus the plugin sends emails and stuff. i don't need those feature. i just need bare minimum
ratan
regarding push. i do that. but if some table had id of 5. then on heroku when i add something to that table again. it is giving duplicate key error because autoincrement id is not same there as my local db. i do `heroku db:push` i'm hoping that would take care of autincremented ids and stuff. but apparently not?
ratan
A: 

autoincrement issue:

maybe using seed data is a better solution for you see http://railscasts.com/episodes/179-seed-data

errors issue:

in the config/environments/production.rb

try replacing

config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching             = true
config.action_view.cache_template_loading            = true

by

config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs                         = true
config.action_controller.perform_caching             = false

cheers

denisjacquemin
A: 

Pushing the data is one thing, but you might want to look into ways to reset the sequence too. On Heroku they use PGSql, so you'd have to look into its documentation.

mjnissim