Reputation: 31
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!
Upvotes: 0
Views: 43
Reputation: 31
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.
Upvotes: 1