title: Rails Heroku app errors
body: <p>My project works well locally. I deployed it to Heroku. I've got some errors and app couldn't run there. I'm using rails 4 with postgresql. Can't understand why this is happens.
  It seems to me that database wasn't created. Should I add specify production settings on my database.yml? </p>
  
  <p><strong>database.yml</strong></p>
  
  <pre><code>development:
    adapter: postgresql
    encoding: utf8
    database: test_store_dev
    pool: 5
    username: mike
    password: mike
    host: 127.0.0.1
  
  test:
    adapter: postgresql
    encoding: utf8
    database: test_store_test
    pool: 5
    username: mike
    password: mike
    host: 127.0.0.1
  </code></pre>
  
  <p><strong>From log:</strong></p>
  
  <pre><code>~/workspace/test_store$ heroku logs --tail
  2014-02-13T13:14:47.731382+00:00 app[web.1]:     3: 
  2014-02-13T13:14:47.731535+00:00 app[web.1]:     6:   &lt;% Category.roots.each do |category| %&gt;
  2014-02-13T13:14:47.731382+00:00 app[web.1]: : SELECT "categories".* FROM "categories"  WHERE "categories"."parent_id" IS NULL  ORDER BY "categories"."lft"):
  2014-02-13T13:14:47.731972+00:00 app[web.1]: I, [2014-02-13T13:13:06.802166 #2]  INFO -- : Started GET "/" for 46.53.195.24 at 2014-02-13 13:13:06 +0000
  2014-02-13T13:14:47.731828+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
  2014-02-13T13:14:47.731972+00:00 app[web.1]: I, [2014-02-13T13:13:06.807361 #2]  INFO -- :   Rendered shared/_search_form.html.erb (0.6ms)
  2014-02-13T13:14:47.731972+00:00 app[web.1]: E, [2014-02-13T13:13:06.810210 #2] ERROR -- : PG::UndefinedTable: ERROR:  relation "categories" does not exist
  2014-02-13T13:14:47.731972+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories"  WHERE "categories"....
  2014-02-13T13:14:47.731828+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
  2014-02-13T13:14:47.731972+00:00 app[web.1]:                                    ^
  2014-02-13T13:14:47.731972+00:00 app[web.1]: : SELECT "categories".* FROM "categories"  WHERE "categories"."parent_id" IS NULL  ORDER BY "categories"."lft"
  2014-02-13T13:14:47.732116+00:00 app[web.1]: I, [2014-02-13T13:13:06.813303 #2]  INFO -- :   Rendered categories/index.html.erb within layouts/application (6.7ms)
  2014-02-13T13:14:47.731972+00:00 app[web.1]: I, [2014-02-13T13:13:06.805622 #2]  INFO -- : Processing by CategoriesController#index as HTML
  2014-02-13T13:14:47.732116+00:00 app[web.1]: F, [2014-02-13T13:13:06.819692 #2] FATAL -- : 
  2014-02-13T13:14:47.732116+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR:  relation "categories" does not exist
  2014-02-13T13:14:47.732116+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories"  WHERE "categories"....
  2014-02-13T13:14:47.732116+00:00 app[web.1]: : SELECT "categories".* FROM "categories"  WHERE "categories"."parent_id" IS NULL  ORDER BY "categories"."lft"):
  2014-02-13T13:14:47.732116+00:00 app[web.1]:     3: 
  2014-02-13T13:14:47.732116+00:00 app[web.1]:     4:   &lt;%= render :partial =&gt; '/shared/search_form' %&gt;
  2014-02-13T13:14:47.732116+00:00 app[web.1]:     5: 
  2014-02-13T13:14:47.732271+00:00 app[web.1]:     6:   &lt;% Category.roots.each do |category| %&gt;
  2014-02-13T13:14:47.732116+00:00 app[web.1]:                                    ^
  2014-02-13T13:14:47.732116+00:00 app[web.1]: I, [2014-02-13T13:13:06.814571 #2]  INFO -- : Completed 500 Internal Server Error in 9ms
  2014-02-13T13:14:47.731683+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'
  2014-02-13T13:14:47.731828+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
  2014-02-13T13:14:47.731683+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `call'
  2014-02-13T13:14:47.732271+00:00 app[web.1]:   app/views/categories/index.html.erb:6:in `_app_views_categories_index_html_erb___3515298162048279666_69853047486040'
  2014-02-13T13:14:47.732271+00:00 app[web.1]: 
  2014-02-13T13:14:47.732271+00:00 app[web.1]: 
  2014-02-13T13:14:47.732271+00:00 app[web.1]: I, [2014-02-13T13:14:42.123367 #2]  INFO -- : Started GET "/" for 46.53.195.24 at 2014-02-13 13:14:42 +0000
  2014-02-13T13:14:47.732271+00:00 app[web.1]:     8:       &lt;h3&gt; &lt;%= link_to category.name, products_path(:category =&gt; category.slug)  %&gt; &lt;/h3&gt;
  2014-02-13T13:14:47.732271+00:00 app[web.1]:     7:     &lt;div class="col-md-4"&gt;
  2014-02-13T13:14:47.732429+00:00 app[web.1]: : SELECT "categories".* FROM "categories"  WHERE "categories"."parent_id" IS NULL  ORDER BY "categories"."lft"
  2014-02-13T13:14:47.732429+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories"  WHERE "categories"....
  2014-02-13T13:14:47.732429+00:00 app[web.1]:                                    ^
  2014-02-13T13:14:47.732598+00:00 app[web.1]:     3: 
  2014-02-13T13:14:47.732598+00:00 app[web.1]:     4:   &lt;%= render :partial =&gt; '/shared/search_form' %&gt;
  2014-02-13T13:14:47.732598+00:00 app[web.1]:     5: 
  2014-02-13T13:14:47.732598+00:00 app[web.1]:     6:   &lt;% Category.roots.each do |category| %&gt;
  2014-02-13T13:14:47.732598+00:00 app[web.1]:     7:     &lt;div class="col-md-4"&gt;
  2014-02-13T13:14:47.732598+00:00 app[web.1]:     8:       &lt;h3&gt; &lt;%= link_to category.name, products_path(:category =&gt; category.slug)  %&gt; &lt;/h3&gt;
  2014-02-13T13:14:47.732429+00:00 app[web.1]: I, [2014-02-13T13:14:42.134755 #2]  INFO -- :   Rendered categories/index.html.erb within layouts/application (9.8ms)
  2014-02-13T13:14:47.732743+00:00 app[web.1]: 
  2014-02-13T13:14:47.732743+00:00 app[web.1]: I, [2014-02-13T13:14:47.723691 #2]  INFO -- :   Rendered shared/_search_form.html.erb (0.6ms)
  2014-02-13T13:14:47.732743+00:00 app[web.1]: E, [2014-02-13T13:14:47.728029 #2] ERROR -- : PG::UndefinedTable: ERROR:  relation "categories" does not exist
  2014-02-13T13:14:47.732743+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories"  WHERE "categories"....
  2014-02-13T13:14:47.732598+00:00 app[web.1]:   app/views/categories/index.html.erb:6:in `_app_views_categories_index_html_erb___3515298162048279666_69853047486040'
  2014-02-13T13:14:47.732598+00:00 app[web.1]: 
  2014-02-13T13:14:47.732743+00:00 app[web.1]: I, [2014-02-13T13:14:47.729251 #2]  INFO -- : Completed 500 Internal Server Error in 11ms
  2014-02-13T13:14:47.732886+00:00 app[web.1]: F, [2014-02-13T13:14:47.731100 #2] FATAL -- : 
  2014-02-13T13:14:47.732886+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR:  relation "categories" does not exist
  2014-02-13T13:14:47.732886+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories"  WHERE "categories"....
  2014-02-13T13:14:47.732886+00:00 app[web.1]:     3: 
  2014-02-13T13:14:47.732743+00:00 app[web.1]:                                    ^
  2014-02-13T13:14:47.732886+00:00 app[web.1]:     5: 
  2014-02-13T13:14:47.732886+00:00 app[web.1]:     6:   &lt;% Category.roots.each do |category| %&gt;
  2014-02-13T13:14:47.732886+00:00 app[web.1]:     7:     &lt;div class="col-md-4"&gt;
  2014-02-13T13:14:47.731828+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  2014-02-13T13:14:47.733034+00:00 app[web.1]:     9: 
  2014-02-13T13:14:47.733034+00:00 app[web.1]:     8:       &lt;h3&gt; &lt;%= link_to category.name, products_path(:category =&gt; category.slug)  %&gt; &lt;/h3&gt;
  2014-02-13T13:14:47.731828+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
  2014-02-13T13:14:47.733034+00:00 app[web.1]: 
  2014-02-13T13:14:47.731828+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
  2014-02-13T13:14:47.732886+00:00 app[web.1]:     4:   &lt;%= render :partial =&gt; '/shared/search_form' %&gt;
  2014-02-13T13:14:47.733034+00:00 app[web.1]:   app/views/categories/index.html.erb:6:in `_app_views_categories_index_html_erb___3515298162048279666_69853047486040'
  2014-02-13T13:14:47.733034+00:00 app[web.1]: 
  2014-02-13T13:14:47.731828+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
  2014-02-13T13:14:47.731828+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
  2014-02-13T13:14:47.731972+00:00 app[web.1]: 
  2014-02-13T13:14:47.731972+00:00 app[web.1]: 
  2014-02-13T13:14:47.731972+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
  2014-02-13T13:14:47.732271+00:00 app[web.1]: I, [2014-02-13T13:14:42.124293 #2]  INFO -- : Processing by CategoriesController#index as HTML
  2014-02-13T13:14:47.732271+00:00 app[web.1]: I, [2014-02-13T13:14:42.127769 #2]  INFO -- :   Rendered shared/_search_form.html.erb (0.5ms)
  2014-02-13T13:14:47.732271+00:00 app[web.1]:     9: 
  2014-02-13T13:14:47.732429+00:00 app[web.1]: I, [2014-02-13T13:14:42.134928 #2]  INFO -- : Completed 500 Internal Server Error in 11ms
  2014-02-13T13:14:47.732429+00:00 app[web.1]: F, [2014-02-13T13:14:42.136566 #2] FATAL -- : 
  2014-02-13T13:14:47.732429+00:00 app[web.1]: E, [2014-02-13T13:14:42.131964 #2] ERROR -- : PG::UndefinedTable: ERROR:  relation "categories" does not exist
  2014-02-13T13:14:47.732429+00:00 app[web.1]: LINE 1: SELECT "categories".* FROM "categories"  WHERE "categories"....
  2014-02-13T13:14:47.732429+00:00 app[web.1]:                                    ^
  2014-02-13T13:14:47.732429+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR:  relation "categories" does not exist
  2014-02-13T13:14:47.732598+00:00 app[web.1]:     9: 
  2014-02-13T13:14:47.732743+00:00 app[web.1]: I, [2014-02-13T13:14:47.715526 #2]  INFO -- : Started GET "/" for 46.53.195.24 at 2014-02-13 13:14:47 +0000
  2014-02-13T13:14:47.732598+00:00 app[web.1]: : SELECT "categories".* FROM "categories"  WHERE "categories"."parent_id" IS NULL  ORDER BY "categories"."lft"):
  2014-02-13T13:14:47.732743+00:00 app[web.1]: : SELECT "categories".* FROM "categories"  WHERE "categories"."parent_id" IS NULL  ORDER BY "categories"."lft"
  2014-02-13T13:14:47.732743+00:00 app[web.1]: I, [2014-02-13T13:14:47.729098 #2]  INFO -- :   Rendered categories/index.html.erb within layouts/application (6.1ms)
  2014-02-13T13:14:47.732743+00:00 app[web.1]: I, [2014-02-13T13:14:47.717991 #2]  INFO -- : Processing by CategoriesController#index as HTML
  2014-02-13T13:14:47.732886+00:00 app[web.1]: : SELECT "categories".* FROM "categories"  WHERE "categories"."parent_id" IS NULL  ORDER BY "categories"."lft"):
  2014-02-13T13:14:47.732886+00:00 app[web.1]:                                    ^
  2014-02-13T13:14:42.190691+00:00 heroku[router]: at=info method=GET path=/ host=thawing-mesa-8086.herokuapp.com request_id=fa0aa0ee-7720-49c0-a2c4-271131bf6688 fwd="46.53.195.24" dyno=web.1 connect=0ms service=75ms status=500 bytes=1266
  </code></pre>