download files from heroku - ruby-on-rails

I have a utility on ruby on rails that uploads files to public folder. And by providing the link to that file i can download that file.
It is working fine on local rails server.
I deployed my work to heroku. where uploading part works. but when i click to login button it simply gives error
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
on looking to heroku logs, i noticed it is a routing error.
Any one please let me know what i am missing. as i am really beginner with heroku.
Thanks regards,
Update
Here are the heroku logs
2014-08-12T12:44:02.705737+00:00 app[web.1]: Rendered internships/show.html.erb within layouts/application (23.2ms)
2014-08-12T12:44:14.260997+00:00 heroku[router]: at=info method=GET path="/resume/Saghir%20Resume1.docx" host=shielded-atoll-2450.herokuapp.com request_id=87d911ee-2bb3-40e7-923b-a8029f7ab6ff fwd="39.44.84.14" dyno=web.1 connect=2ms service=27ms status=404 bytes=1182
2014-08-12T12:44:14.253695+00:00 app[web.1]: Started GET "/resume/Saghir%20Resume1.docx" for 39.44.84.14 at 2014-08-12 12:44:14 +0000
2014-08-12T12:44:14.256004+00:00 app[web.1]:
2014-08-12T12:44:14.253706+00:00 app[web.1]: Started GET "/resume/Saghir%20Resume1.docx" for 39.44.84.14 at 2014-08-12 12:44:14 +0000
2014-08-12T12:44:14.256011+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-08-12T12:44:14.256016+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2014-08-12T12:44:14.256007+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/resume/Saghir%20Resume1.docx"):
2014-08-12T12:44:14.256009+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-08-12T12:44:14.256014+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `block in call'
2014-08-12T12:44:14.256017+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:26:in `tagged'
2014-08-12T12:44:14.256012+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:38:in `call_app'
2014-08-12T12:44:14.256056+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-08-12T12:44:14.256059+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-08-12T12:44:14.256054+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/application.rb:97:in `call'
2014-08-12T12:44:14.256022+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-08-12T12:44:14.256063+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-08-12T12:44:14.256019+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `tagged'
2014-08-12T12:44:14.256020+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `call'
2014-08-12T12:44:14.256064+00:00 app[web.1]:
2014-08-12T12:44:14.256060+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-08-12T12:44:14.256078+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `block in call'
2014-08-12T12:44:14.256066+00:00 app[web.1]:
2014-08-12T12:44:14.256057+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-08-12T12:44:14.256094+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/engine.rb:511:in `call'
2014-08-12T12:44:14.256023+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-08-12T12:44:14.256077+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:38:in `call_app'
2014-08-12T12:44:14.256072+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/resume/Saghir%20Resume1.docx"):
2014-08-12T12:44:14.256074+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-08-12T12:44:14.256090+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-08-12T12:44:14.256080+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2014-08-12T12:44:14.256098+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-08-12T12:44:14.256091+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-08-12T12:44:14.256025+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-08-12T12:44:14.256104+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-08-12T12:44:14.256027+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-08-12T12:44:14.256097+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-08-12T12:44:14.256085+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-08-12T12:44:14.256095+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/application.rb:97:in `call'
2014-08-12T12:44:14.256102+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-08-12T12:44:14.256083+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `tagged'

Your link is to /resume/Saghir%20Resume1.docx (/resume/Saghir Resume1.docx) but you say its in the public folder -- is the upload directory /public/resume/file_name? And are you set for Rails to serve_static_assets?
As #CodeGnome pointed out, Heroku is an ephemeral filesystem so the entire approach is a bad idea -- typically you'd use Amazon S3 or a similar filestore for your uploaded files. Even if your routes are right, the file you uploaded can be on a different dyno because you're running more than one or because you've redeployed.

Heroku has something called the Ephemeral filesystem, so during the dyno’s lifetime its running processes can make use of it, but any file stored here will be discarded after the dyno has finished, so yes it does save the file, but after that it is deleted so it won't find it.
A very common approach is using paperclip and Amazon S3 for handling/storing the uploads, and those are pretty straightforward to install too. Here is a great article explaining how to do so: https://devcenter.heroku.com/articles/paperclip-s3

Related

EOFError: Bad Content Body in API

There's a few other stack posts around similar errors, though the trace of mine highlights different method failures and typically these errors occur in multipart forms, which mine is not. I've been looking at this problem on and off for a few weeks now and decided it was time to ask others for help.
The scenario: I have an API mounted engine which I built. It's lightweight, has a controller and a method to receive post requests with data logs. These logs are often 60,000~ bytes in size and are accessed through request.body.read. To make sure it wasn't an error provoked by my code. I removed everything, it's literally an empty method that just returns 200 now. Like this:
def tcpdata
return 200
end
Yet, I still get the error. Which makes it really frustrating because it seems out of my hands.
The error I get is ERROR EOFError: bad content body and it's failing in the rack multipart method get_current_head_and_filename_and_content_type_and_name_and_body
Here's the full trace:
2016-07-16T12:31:06.624089+00:00 heroku[router]: at=info method=POST path="/api/endpoint/devices" host=getbeambox.com request_id=992b3308-97db-4dbe-9ab0-343ee0a4f49f fwd="79.77.176.13,141.101.99.214" dyno=web.1 connect=1ms service=309ms status=500 bytes=507
2016-07-16T12:31:06.627426+00:00 app[web.1]: [2016-07-16 12:31:06] ERROR EOFError: bad content body
2016-07-16T12:31:06.627448+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/multipart/parser.rb:148:in `get_current_head_and_filename_and_content_type_and_name_and_body'
2016-07-16T12:31:06.627450+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/multipart/parser.rb:59:in `block in parse'
2016-07-16T12:31:06.627451+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/multipart/parser.rb:56:in `loop'
2016-07-16T12:31:06.627452+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/multipart/parser.rb:56:in `parse'
2016-07-16T12:31:06.627452+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/multipart.rb:25:in `parse_multipart'
2016-07-16T12:31:06.627453+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/request.rb:375:in `parse_multipart'
2016-07-16T12:31:06.627454+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/request.rb:207:in `POST'
2016-07-16T12:31:06.627454+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:39:in `method_override_param'
2016-07-16T12:31:06.627455+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:27:in `method_override'
2016-07-16T12:31:06.627456+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:15:in `call'
2016-07-16T12:31:06.627457+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627458+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
2016-07-16T12:31:06.627459+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627459+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2016-07-16T12:31:06.627460+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627461+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/static.rb:116:in `call'
2016-07-16T12:31:06.627462+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627463+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
2016-07-16T12:31:06.627463+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627464+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:518:in `call'
2016-07-16T12:31:06.627465+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:165:in `call'
2016-07-16T12:31:06.627466+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/newrelic_rpm-3.15.0.314/lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
2016-07-16T12:31:06.627466+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
2016-07-16T12:31:06.627467+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'
2016-07-16T12:31:06.627468+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'
2016-07-16T12:31:06.627469+00:00 app[web.1]: /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
2016-07-16T12:31:06.627469+00:00 app[web.1]: /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
2016-07-16T12:31:06.627470+00:00 app[web.1]: /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
For me Postman was creating problem when I had selected form-data in the BODY tab. When I changed it to raw it worked for me.
I have seen this error in multipart forms.

Persist spree product pictures after 'heroku restart'

I have a sample page I'm working on:
http://os-oven.herokuapp.com/
where I started uploading pictures for products. At some point during my trying things out, I had to run
heroku restart
which wiped out my pictures:
2015-01-08T14:13:39.161552+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/spree/products/1/small/Pumpkin_Pie_from_a_-real-_pumpkin__November_2007.jpg"):
2015-01-08T14:13:39.161554+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2015-01-08T14:13:39.161555+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2015-01-08T14:13:39.161573+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/rack/logger.rb:38:in `call_app'
2015-01-08T14:13:39.161574+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/rack/logger.rb:20:in `block in call'
2015-01-08T14:13:39.161576+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2015-01-08T14:13:39.161578+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/tagged_logging.rb:26:in `tagged'
2015-01-08T14:13:39.161579+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/tagged_logging.rb:68:in `tagged'
2015-01-08T14:13:39.161581+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/rack/logger.rb:20:in `call'
2015-01-08T14:13:39.161582+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2015-01-08T14:13:39.161584+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2015-01-08T14:13:39.161585+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2015-01-08T14:13:39.161586+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
2015-01-08T14:13:39.161588+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/static.rb:84:in `call'
2015-01-08T14:13:39.161590+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2015-01-08T14:13:39.161591+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/engine.rb:514:in `call'
2015-01-08T14:13:39.161593+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application.rb:144:in `call'
2015-01-08T14:13:39.161594+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:576:in `process_client'
2015-01-08T14:13:39.161596+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:670:in `worker_loop'
2015-01-08T14:13:39.161597+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:525:in `spawn_missing_workers'
2015-01-08T14:13:39.161598+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:140:in `start'
2015-01-08T14:13:39.161600+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/bin/unicorn:126:in `<top (required)>'
2015-01-08T14:13:39.161601+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/bin/unicorn:23:in `load'
2015-01-08T14:13:39.161602+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/bin/unicorn:23:in `<main>'
The pictures must have been saved locally, and when I restarted my app, it pulled the latest code from git.
How do I persist product pictures in the database for spree?
My thoughts:
Put them in something like s3. Downside to this is I would rather have a 'free-er' option for now. Plus, how would you configure spree to do this?
Get the files in version control. This may work, except I would need prod and dev to use the same db with the same file paths stored in the db.
Persist blobs to the db. I know this is probably not the most efficient way, but the data would always be available. Still would have to tweak the spree engine to do this.
You can't save picture on heroku.
Heroku has "Read-only Filesystem" https://devcenter.heroku.com/articles/read-only-filesystem
For free you can use cloudinary.com or Amazon S3
Amazon S3 also free up to 5Gb. http://aws.amazon.com/free/

Routing error in heroku app after deployment with git push command

I am at chapter 3 of Michael Hartl's tutorial but when I do git push heroku master and it says that it has been deployed to heroku successfully but when I go to the url: http://young-thicket-2043.herokuapp.com/ it says that the app cannot be seen.
I've checked out heroku logs and this was given:
2014-07-02T08:07:16.462137+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-07-02T08:07:16.462132+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-07-02T08:07:16.462138+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/engine.rb:511:in `call'
2014-07-02T08:07:16.462148+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-07-02T08:07:16.462150+00:00 app[web.1]:
2014-07-02T08:07:16.462151+00:00 app[web.1]:
2014-07-02T08:07:16.462158+00:00 app[web.1]:
2014-07-02T08:07:16.462159+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/"):
2014-07-02T08:07:16.462161+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-07-02T08:07:16.462162+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-07-02T08:07:16.462164+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:38:in `call_app'
2014-07-02T08:07:16.462165+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `block in call'
2014-07-02T08:07:16.462167+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2014-07-02T08:07:16.462168+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:26:in `tagged'
2014-07-02T08:07:16.462170+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `tagged'
2014-07-02T08:07:16.462171+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `call'
2014-07-02T08:07:16.462173+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-07-02T08:07:16.462174+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-07-02T08:07:16.462176+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-07-02T08:07:16.462177+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-07-02T08:07:16.462180+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-07-02T08:07:16.462194+00:00 app[web.1]:
2014-07-02T08:07:16.462179+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-07-02T08:07:16.462184+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-07-02T08:07:16.462185+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-07-02T08:07:16.462187+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-07-02T08:07:16.462181+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/engine.rb:511:in `call'
2014-07-02T08:07:16.462183+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/application.rb:97:in `call'
2014-07-02T08:07:16.462191+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-07-02T08:07:16.462192+00:00 app[web.1]:
2014-07-02T08:07:16.462188+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-07-02T08:07:16.462190+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-07-02T08:07:16.781513+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=young-thicket-2043.herokuapp.com request_id=f65ad084-f721-4a4c-8f99-bdd1938d4dd4 fwd="192.122.131.37" dyno=web.1 connect=0ms service=5ms status=304 bytes=133
2014-07-02T08:16:35.325747+00:00 heroku[router]: at=info method=GET path="/" host=young-thicket-2043.herokuapp.com request_id=4fc6cfec-39d8-4a2c-ac04-09013042ca7b fwd="192.122.131.37" dyno=web.1 connect=1ms service=520ms status=404 bytes=1616
2014-07-02T08:16:35.319865+00:00 app[web.1]:
2014-07-02T08:16:35.319873+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-07-02T08:16:35.319874+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-07-02T08:16:35.319870+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/"):
2014-07-02T08:16:35.217481+00:00 app[web.1]: Started GET "/" for 192.122.131.37 at 2014-07-02 08:16:35 +0000
2014-07-02T08:16:35.319876+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:38:in `call_app'
2014-07-02T08:16:35.319891+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-07-02T08:16:35.319878+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `block in call'
2014-07-02T08:16:35.319892+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-07-02T08:16:35.319880+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2014-07-02T08:16:35.319881+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:26:in `tagged'
2014-07-02T08:16:35.319921+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-07-02T08:16:35.319883+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `tagged'
2014-07-02T08:16:35.319886+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-07-02T08:16:35.319884+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `call'
2014-07-02T08:16:35.225563+00:00 app[web.1]: Started GET "/" for 192.122.131.37 at 2014-07-02 08:16:35 +0000
2014-07-02T08:16:35.319919+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-07-02T08:16:35.321135+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `block in call'
2014-07-02T08:16:35.321133+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-07-02T08:16:35.319923+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-07-02T08:16:35.319887+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-07-02T08:16:35.321127+00:00 app[web.1]:
2014-07-02T08:16:35.319895+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/engine.rb:511:in `call'
2014-07-02T08:16:35.319897+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/application.rb:97:in `call'
2014-07-02T08:16:35.319894+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-07-02T08:16:35.321137+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2014-07-02T08:16:35.321145+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-07-02T08:16:35.321147+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-07-02T08:16:35.321134+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:38:in `call_app'
2014-07-02T08:16:35.321138+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:26:in `tagged'
2014-07-02T08:16:35.319901+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-07-02T08:16:35.319899+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-07-02T08:16:35.319898+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-07-02T08:16:35.319925+00:00 app[web.1]:
2014-07-02T08:16:35.319889+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-07-02T08:16:35.319924+00:00 app[web.1]:
2014-07-02T08:16:35.321141+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `call'
2014-07-02T08:16:35.321161+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-07-02T08:16:35.321140+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `tagged'
2014-07-02T08:16:35.321130+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/"):
2014-07-02T08:16:35.321144+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-07-02T08:16:35.321151+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/engine.rb:511:in `call'
2014-07-02T08:16:35.321149+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-07-02T08:16:35.321131+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-07-02T08:16:35.321158+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-07-02T08:16:35.321148+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-07-02T08:16:35.321155+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-07-02T08:16:35.321162+00:00 app[web.1]:
2014-07-02T08:16:35.321142+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-07-02T08:16:35.321154+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-07-02T08:16:35.321152+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/application.rb:97:in `call'
2014-07-02T08:16:35.321156+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-07-02T08:16:35.321159+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-07-02T08:16:35.321163+00:00 app[web.1]:
2014-07-02T08:16:35.764555+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=young-thicket-2043.herokuapp.com request_id=ca661424-73d7-4799-8ad7-5fed577fd9c2 fwd="192.122.131.37" dyno=web.1 connect=1ms service=52ms status=304 bytes=133
2014-07-02T08:16:40.905460+00:00 heroku[api]: Starting process with command `bundle exec rake db` by huicheese#gmail.com
2014-07-02T08:16:44.546386+00:00 heroku[run.7223]: State changed from starting to up
2014-07-02T08:16:44.833806+00:00 heroku[run.7223]: Awaiting client
2014-07-02T08:16:55.930802+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by huicheese#gmail.com
2014-07-02T08:16:59.934050+00:00 heroku[run.6502]: State changed from starting to up
2014-07-02T08:16:59.814001+00:00 heroku[run.6502]: Awaiting client
2014-07-02T08:17:16.236553+00:00 heroku[run.7223]: State changed from up to complete
2014-07-02T08:17:16.224283+00:00 heroku[run.7223]: Process exited with status 128
2014-07-02T08:17:14.840989+00:00 heroku[run.7223]: Error R13 (Attach error) -> Failed to attach to process
2014-07-02T08:17:31.040049+00:00 heroku[run.6502]: State changed from up to complete
2014-07-02T08:17:29.816567+00:00 heroku[run.6502]: Error R13 (Attach error) -> Failed to attach to process
2014-07-02T08:17:31.023583+00:00 heroku[run.6502]: Process exited with status 128
Can anyone shed some light on this?
If you look at your logs you can see
ActionController::RoutingError (No route matches [GET] "/")
Which basically means that you don't have any root route setup in your routes.rb. Inside your routes.rb add this line:
root 'pages#show'
By writing this you are setting your root route to Page Controllers show action

What does changing RACK_ENV and RAILS_ENV do?

I have deployed my application to Heroku and forked the environment to create a 'staging' environment. I copied my paroduction.rb file to create a staging.rb, but when I change the RAILS_ENV and RACK_ENV variables from production to staging no assets are returned and the logs show the following type errors:
2014-05-05T07:42:33.614170+00:00 app[web.1]: F, [2014-05-05T07:42:33.610206 #2] FATAL -- :
2014-05-05T07:42:33.614172+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/application-835271b3bd7cf8b176e8b30d9ca395fd.js"):
2014-05-05T07:42:33.614173+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.4/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-05-05T07:42:33.614174+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.4/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-05-05T07:42:33.614176+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/rack/logger.rb:38:in `call_app'
2014-05-05T07:42:33.614177+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/rack/logger.rb:20:in `block in call'
2014-05-05T07:42:33.614178+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2014-05-05T07:42:33.614200+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/tagged_logging.rb:26:in `tagged'
2014-05-05T07:42:33.614202+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/tagged_logging.rb:68:in `tagged'
2014-05-05T07:42:33.614203+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/rack/logger.rb:20:in `call'
2014-05-05T07:42:33.614204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.4/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-05-05T07:42:33.614206+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-05-05T07:42:33.614207+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-05-05T07:42:33.614218+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-05-05T07:42:33.614219+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-05-05T07:42:33.614221+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/engine.rb:511:in `call'
2014-05-05T07:42:33.614222+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/application.rb:97:in `call'
2014-05-05T07:42:33.614224+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-05-05T07:42:33.614225+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-05-05T07:42:33.614226+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-05-05T07:42:33.614228+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-05-05T07:42:33.614229+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-05-05T07:42:33.614231+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
I have found other posts on Stackoverflow e.g.: ActionController::RoutingError (No route matches [GET] "/assets/images/control_top.png"): in rails 3.2.8
and indeed changing config.serve_static_assets = false to true solves the problem, but I am reluctant to do this in just my staging environment and I understand that this will affect performance within the production environment.
What I really do not understand is why this error is occurring when the only difference as far as I can tell is that the environment variable names are changed. So to my question:
What does changing these environment variables actually change about the application? Why does it have this effect in my application?
As a bonus if there is a better way to solve the underlying problem I have described to have staging mirroring the production config I would appreciate the guidance.
Further investigation has established that the setting of environment variables has the following effect within deployment:
The environment-specific configuration files (such as config/environments/production.rb)
installation of gems as defined within the Gemfile group (e.g. group :production)
In this case heroku requires the gem 'rails_12factor' to enable static assets to be served. Therefore in addition to the group :production this gem is required for :staging.

Apartment::SchemaNotFound when trying to deploy multi-tenancy Rails app on Heroku

I have been working on an app locally for a while now, and I've matched my development environment to that on Heroku as closely as I can.
The app is set up for multi-tenancy using Apartment (https://github.com/influitive/apartment), and designed to use subdomains to identify tenants. Both environments use postgres, and Apartment has been using schemas to manage the 'tanants' data.
This evening, I have attempted to push the code to Heroku (the same app before it became multi-tenancy worked beautifully), and no pages load, all give an error.
I've taken a look at the logs, and the most interesting line I can find is; Apartment::SchemaNotFound (One of the following schema(s) is invalid: heroku-app-name, "public"):
This certainly seems to be a peculiarity of Heroku, but I'm struggling for ideas on where to look next.
Any suggestions or help would be appreciated.
I've included all of the logs for reference;
2014-04-04T18:27:09.884367+00:00 app[web.1]: Apartment::SchemaNotFound (One of the following schema(s) is invalid: heroku-app-name, "public"):
2014-04-04T18:27:09.884368+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/apartment-0.24.3/lib/apartment/adapters/postgresql_adapter.rb:95:in `rescue in connect_to_new'
2014-04-04T18:27:09.884384+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/etag.rb:23:in `call'
2014-04-04T18:27:09.884362+00:00 app[web.1]:
2014-04-04T18:27:09.884385+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/conditionalget.rb:25:in `call'
2014-04-04T18:27:09.884364+00:00 app[web.1]: I, [2014-04-04T18:27:09.879482 #2] INFO -- : Started GET "/favicon.ico" for 92.25.163.224 at 2014-04-04 18:27:09 +0000
2014-04-04T18:27:09.884388+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
2014-04-04T18:27:09.884389+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/flash.rb:241:in `call'
2014-04-04T18:27:09.884366+00:00 app[web.1]: F, [2014-04-04T18:27:09.884136 #2] FATAL -- :
2014-04-04T18:27:09.884370+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/apartment-0.24.3/lib/apartment/adapters/postgresql_adapter.rb:88:in `connect_to_new'
2014-04-04T18:27:09.884381+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
2014-04-04T18:27:09.884371+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/apartment-0.24.3/lib/apartment/adapters/abstract_adapter.rb:100:in `switch'
2014-04-04T18:27:09.884383+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
2014-04-04T18:27:09.884396+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
2014-04-04T18:27:09.884372+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/apartment-0.24.3/lib/apartment/elevators/generic.rb:20:in `call'
2014-04-04T18:27:09.884387+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
2014-04-04T18:27:09.884398+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
2014-04-04T18:27:09.884403+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
2014-04-04T18:27:09.884391+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225:in `context'
2014-04-04T18:27:09.884392+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220:in `call'
2014-04-04T18:27:09.884399+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:373:in `_run__2212192162733263500__call__callbacks'
2014-04-04T18:27:09.884400+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in `run_callbacks'
2014-04-04T18:27:09.884393+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/cookies.rb:486:in `call'
2014-04-04T18:27:09.884402+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2014-04-04T18:27:09.884406+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-04-04T18:27:09.884379+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
2014-04-04T18:27:09.884395+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/query_cache.rb:36:in `call'
2014-04-04T18:27:09.884409+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `block in call'
2014-04-04T18:27:09.884407+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:38:in `call_app'
2014-04-04T18:27:09.884410+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2014-04-04T18:27:09.884404+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
2014-04-04T18:27:09.884430+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `tagged'
2014-04-04T18:27:09.884431+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-04-04T18:27:09.884432+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-04-04T18:27:09.884428+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:25:in `tagged'
2014-04-04T18:27:09.884435+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-04-04T18:27:09.884444+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2014-04-04T18:27:09.884434+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-04-04T18:27:09.884437+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-04-04T18:27:09.884442+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2014-04-04T18:27:09.884445+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-04-04T18:27:09.884448+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-04-04T18:27:09.884446+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-04-04T18:27:09.884450+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-04-04T18:27:09.884451+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-04-04T18:27:09.884452+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
Take a look at your apartment initializer and remove the subdomain elevator settings. i commented out everything related to elevator. since your app is probably on a heroku subdomain, the elevator setting will try to load that particular tenant from the db and will issue that error.
it worked fine for me after i commented
# Rails.application.config.middleware.use 'Apartment::Elevators::Subdomain'

Resources