0

I have a Rails App perfectly working in development and well tested. When deployed on heroku there is no problem reported, but the app won't work anyway. Opening it in the browser only delivers:

We're sorry, but something went wrong. If you are the application owner check the logs for more information."

In the log I see a pg expression which works on my variable/table "countries" although I am not too familiar with the meaning:

app[web.1]:                      pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod

app[web.1]:                 FROM pg_attribute a LEFT JOIN pg_attrdef d

app[web.1]:                WHERE a.attrelid = '"countries"'::regclass

app[web.1]:                  AND a.attnum > 0 AND NOT a.attisdropped

app[web.1]:                ORDER BY a.attnum

app[web.1]:   app/controllers/application_controller.rb:15:in `default_or_selected_country'

app[web.1]: 

heroku[router]: at=info method=GET path="/" host=evening-refuge-96756.herokuapp.com request_id=a240125e-4115-40d4-bfb0-ade1b8c909d6 fwd="178.165.130.180" dyno=web.1 connect=1ms service=204ms status=500 bytes=1714

I see that my method `default_or_selected_country' is involved. The respective code is unproblematic in development and test mode:

def default_or_selected_country
  session[:country_id] ||= Country.find_by(abbreviation: "AT").id
  @default_or_selected_country = Country.find(session[:country_id]).name
end

While I am writing this post more similar pg expressions are logged, always containing the "countries" table and also pointing to the same method as above.

Where is my problem and how can I solve it? Thanks!

3
  • 1. Run migrations on Heroku if you didn't 2. Restart server. Commented May 15, 2016 at 22:05
  • Are you sure you have data inside countries table? Commented May 16, 2016 at 14:50
  • Thanks, Sebin, that is exactly it! Commented May 17, 2016 at 18:56

1 Answer 1

1

Indeed my app needs some data seeded initially since controllers are pulling it to populate drop-down selectors. Locally this is done by

rake db:seed

On Heroku it is simply done by

heroku run --app APP rake db:seed

as written here using just the same seeds.rb as locally.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.