Mongomapper and Sinatra undefined method `update_attributes' for nil:NilClass - ruby

I getting the error "undefined method `update_attributes' for nil:NilClass" when using Sinatra with MongoMapper.
Model:
class Publication
include MongoMapper::Document
key :page, String
key :title, String
key :body, String
end
and code where i getting error:
post '/edit' do
#article = Publication.update({:page => 'main'}, {$set => {:title => params[:title], :body => params[:body]}})
end
i'm tried to make update in mongo console and it was successfully updated:
> db.publications.update({page: 'main'},{$set: {body: '333', title: '111'}})
> db.publications.find({page: 'main'})
{ "_id" : ObjectId("4fa45046530a6978e3000003"), "body" : "333", "page" : "main", "title" : "111" }
Full stack trace:
[2012-05-06 03:04:22] INFO WEBrick 1.3.1
[2012-05-06 03:04:22] INFO ruby 1.8.7 (2010-01-10) [universal-darwin11.0]
== Sinatra/1.3.2 has taken the stage on 4567 for development with backup from WEBrick
[2012-05-06 03:04:23] INFO WEBrick::HTTPServer#start: pid=32266 port=4567
localhost - - [06/May/2012:03:04:27 MSK] "GET /edit HTTP/1.1" 200 193
- -> /edit
localhost - - [06/May/2012:03:04:27 MSK] "GET /favicon.ico HTTP/1.1" 404 447
- -> /favicon.ico
NoMethodError - undefined method `update_attributes' for nil:NilClass:
/Library/Ruby/Gems/1.8/gems/mongo_mapper- 0.11.1/lib/mongo_mapper/plugins/querying.rb:118:in `update_single'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.11.1/lib/mongo_mapper/plugins/querying.rb:117:in `tap'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.11.1/lib/mongo_mapper/plugins/querying.rb:117:in `update_single'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.11.1/lib/mongo_mapper/plugins/querying.rb:45:in `update'
main.rb:48:in `POST /edit'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1211:in `call'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1211:in `compile!'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `[]'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `route!'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:801:in `route_eval'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `route!'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:822:in `process_route'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in `catch'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in `process_route'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:784:in `route!'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in `each'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in `route!'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:886:in `dispatch!'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in `call!'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `invoke'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `catch'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `invoke'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in `call!'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:705:in `call'
/Library/Ruby/Gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call'
/Library/Ruby/Gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/path_traversal.rb:16:in `call'
/Library/Ruby/Gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/json_csrf.rb:17:in `call'
/Library/Ruby/Gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/base.rb:47:in `call'
/Library/Ruby/Gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/logger.rb:15:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/head.rb:9:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/showexceptions.rb:21:in `call'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in `call'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1416:in `synchronize'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:13:in `run'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1295:in `run!'
/Library/Ruby/Gems/1.8/gems/sinatra-1.3.2/lib/sinatra/main.rb:25
main.rb:53
anyone can say for what reason I do not get properly updated in the ruby code?

You probably meant to have :$set instead of $set as your key:
#article = Publication.update({:page => 'main'}, {:$set => {:title => params[:title], :body => params[:body]}})
What you have is using the global variable $set for the key, which is nil (since all global variables default to nil). For example:
{ $set => "something" } #=> {nil=>"something"}
{ :$set => "something" } #=> {:$set=>"something"}

Related

Unable to log into Rails 5 app in Heroku with the Devise gem

In a moment of insanity, I decided to make a Rails 5 app that uses the Devise gem and Omniauth. Everything appears to work in the development environment (though I haven't configured it to send emails from there...the cukes are passing! =D) but when I push it to Heroku and migrate (and even when I try restarting the dyno), I can't log in using a valid email and password (or via omniauth but that was expected), when I try to sign up, the account is created but no authentication email is ever sent. I can't resend the confirmation email and when I tried confirming an existing account via rails console in Heroku, I was then unable to reset the account's password using the forgotten password link on the app. No matter what I do, I receive the generic 500 error advising me to check my logs. As far as I can tell, the problem seems to be with Devise or ActionMailer as the rest of the site loads correctly.
I've tried changing my Gmail settings on the following pages:
Display Unlock Captcha
Less Secure Apps (which I haven't had to use for my Rails 4 apps recently)
I've tried making various tweaks to the config files and such but so far nothing's worked.
Heroku's logs (from when I tried to send a forgotten password email from the site)
2016-08-27T08:22:49.275213+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:232:in `block in conditional'
2016-08-27T08:22:49.275273+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `block in call'
2016-08-27T08:22:49.275332+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `call'
2016-08-27T08:22:49.275302+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `each'
2016-08-27T08:22:49.275656+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:334:in `rollback_active_record_state!'
2016-08-27T08:22:49.275713+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/suppressor.rb:41:in `save'
2016-08-27T08:22:49.275774+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/lib/devise/models/recoverable.rb:45:in `send_reset_password_instructions'
2016-08-27T08:22:49.275362+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
2016-08-27T08:22:49.275509+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:202:in `within_new_transaction'
2016-08-27T08:22:49.275391+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_commit_callbacks'
2016-08-27T08:22:49.275155+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:382:in `block in make_lambda'
2016-08-27T08:22:49.275420+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:354:in `committed!'
2016-08-27T08:22:49.275451+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:87:in `commit_records'
2016-08-27T08:22:49.275684+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:318:in `save'
2016-08-27T08:22:49.276127+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
2016-08-27T08:22:49.276268+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
2016-08-27T08:22:49.275479+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:178:in `commit_transaction'
2016-08-27T08:22:49.276857+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal.rb:262:in `dispatch'
2016-08-27T08:22:49.276997+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:46:in `serve'
2016-08-27T08:22:49.275241+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:456:in `call'
2016-08-27T08:22:49.277110+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:725:in `call'
2016-08-27T08:22:49.277194+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in `call!'
2016-08-27T08:22:49.277251+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in `call!'
2016-08-27T08:22:49.277279+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:in `call'
2016-08-27T08:22:49.277307+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:35:in `block in call'
2016-08-27T08:22:49.277447+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/head.rb:12:in `call'
2016-08-27T08:22:49.277630+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
2016-08-27T08:22:49.277658+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
2016-08-27T08:22:49.277856+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `block in tagged'
2016-08-27T08:22:49.278095+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/executor.rb:12:in `call'
2016-08-27T08:22:49.275538+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
2016-08-27T08:22:49.275567+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:211:in `transaction'
2016-08-27T08:22:49.275597+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
2016-08-27T08:22:49.275859+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
2016-08-27T08:22:49.275927+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
2016-08-27T08:22:49.276069+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
2016-08-27T08:22:49.276211+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
2016-08-27T08:22:49.276296+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:164:in `block in instrument'
2016-08-27T08:22:49.276800+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionview-5.0.0.1/lib/action_view/rendering.rb:30:in `process'
2016-08-27T08:22:49.277223+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:in `call'
2016-08-27T08:22:49.277587+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
2016-08-27T08:22:49.277799+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:36:in `call_app'
2016-08-27T08:22:49.278008+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/method_override.rb:22:in `call'
2016-08-27T08:22:49.278133+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/static.rb:136:in `call'
2016-08-27T08:22:49.275626+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:319:in `block in save'
2016-08-27T08:22:49.275743+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/lib/devise/models/recoverable.rb:88:in `set_reset_password_token'
2016-08-27T08:22:49.275802+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/lib/devise/models/recoverable.rb:119:in `send_reset_password_instructions'
2016-08-27T08:22:49.275901+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/base.rb:188:in `process_action'
2016-08-27T08:22:49.275956+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
2016-08-27T08:22:49.275984+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:126:in `call'
2016-08-27T08:22:49.276012+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:126:in `call'
2016-08-27T08:22:49.276041+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
2016-08-27T08:22:49.276466+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
2016-08-27T08:22:49.277082+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:26:in `serve'
2016-08-27T08:22:49.277532+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/cookies.rb:613:in `call'
2016-08-27T08:22:49.277714+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
2016-08-27T08:22:49.278038+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/runtime.rb:22:in `call'
2016-08-27T08:22:49.276098+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
2016-08-27T08:22:49.276381+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
2016-08-27T08:22:49.276885+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
2016-08-27T08:22:49.277504+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:216:in `call'
2016-08-27T08:22:49.278267+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:415:in `process_client'
2016-08-27T08:22:49.276155+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
2016-08-27T08:22:49.276239+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/rescue.rb:20:in `process_action'
2016-08-27T08:22:49.276437+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/searchkick-1.3.3/lib/searchkick/logging.rb:153:in `process_action'
2016-08-27T08:22:49.277025+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:39:in `block in serve'
2016-08-27T08:22:49.277391+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/etag.rb:25:in `call'
2016-08-27T08:22:49.277884+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:26:in `tagged'
2016-08-27T08:22:49.278352+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/thread_pool.rb:116:in `block in spawn_thread'
2016-08-27T08:22:49.276324+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
2016-08-27T08:22:49.276352+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:164:in `instrument'
2016-08-27T08:22:49.276913+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:32:in `serve'
2016-08-27T08:22:49.276969+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:46:in `call'
2016-08-27T08:22:49.277743+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
2016-08-27T08:22:49.277828+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `block in call'
2016-08-27T08:22:49.277914+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `tagged'
2016-08-27T08:22:49.277980+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/request_id.rb:24:in `call'
2016-08-27T08:22:49.278239+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:578:in `handle_request'
2016-08-27T08:22:49.276409+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
2016-08-27T08:22:49.277560+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
2016-08-27T08:22:49.277686+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/callbacks.rb:36:in `call'
2016-08-27T08:22:49.277167+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:in `call'
2016-08-27T08:22:49.277336+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:34:in `catch'
2016-08-27T08:22:49.277953+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `call'
2016-08-27T08:22:49.275829+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/bundler/gems/devise-4c3838bb759e/app/controllers/devise/passwords_controller.rb:13:in `create'
2016-08-27T08:22:49.276184+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
2016-08-27T08:22:49.277054+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/journey/router.rb:26:in `each'
2016-08-27T08:22:49.277139+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in `call!'
2016-08-27T08:22:49.277419+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/conditional_get.rb:38:in `call'
2016-08-27T08:22:49.276773+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/abstract_controller/base.rb:126:in `process'
2016-08-27T08:22:49.276828+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_controller/metal.rb:190:in `dispatch'
2016-08-27T08:22:49.276941+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/mapper.rb:16:in `block in <class:Constraints>'
2016-08-27T08:22:49.277364+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/warden-1.2.6/lib/warden/manager.rb:34:in `call'
2016-08-27T08:22:49.277475+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:222:in `context'
2016-08-27T08:22:49.277771+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
2016-08-27T08:22:49.278067+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2016-08-27T08:22:49.278154+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in `call'
2016-08-27T08:22:49.278184+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:522:in `call'
2016-08-27T08:22:49.278211+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/configuration.rb:225:in `call'
2016-08-27T08:22:49.278324+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/thread_pool.rb:116:in `call'
2016-08-27T08:22:49.278296+00:00 app[web.1]: [0635e4c5-2a5f-467e-b067-a9906868f73d] vendor/bundle/ruby/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:275:in `block in run'
My current Gemfile
source 'https://rubygems.org'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'jquery-rails'
gem 'sprockets', '>=3.0.0.beta'
#gem 'sprockets-es6'
gem 'haml'
gem 'nokogiri'
gem 'devise', git: 'https://github.com/plataformatec/devise.git', branch: 'master'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'omniauth-instagram'
gem 'cancancan'
gem 'figaro'
gem 'humanize_boolean'
gem 'carrierwave', git: 'https://github.com/carrierwaveuploader/carrierwave'
gem 'mini_magick', '~> 3.8.0'
gem 'fog'
gem 'geocoder'
gem 'elasticsearch-model', git: 'https://github.com/elasticsearch/elasticsearch-rails.git'
gem 'elasticsearch-rails', git: 'https://github.com/elasticsearch/elasticsearch-rails.git'
gem 'searchkick'
gem 'cocoon'
gem 'owlcarousel-rails'
# Use Capistrano for deployment
gem 'capistrano-rails', group: :development
group :test do
gem 'selenium-webdriver'
end
group :development, :test do
gem 'pry-byebug', platform: :mri
gem 'rspec-rails'
gem 'simplecov'
gem 'factory_girl_rails'
gem 'launchy'
gem 'cucumber-rails', :require => false
gem 'database_cleaner'
gem 'faker'
gem 'rails-controller-testing'
gem 'capybara'
gem 'jasmine'
end
group :development do
gem 'web-console'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
group :production do
gem 'rails_12factor'
gem 'aws-sdk'
end
config/environments/production.rb
Rails.application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.js_compressor = :uglifier
config.assets.compile = true
config.log_level = :debug
config.log_tags = [ :request_id ]
config.action_mailer.perform_caching = false
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = {
host: ENV["MAILER_HOST"], #Rails.application.secrets.mailer_host,
from: ENV["MAILER_FROM"]#Rails.application.secrets.mailer_from
}
Rails.application.routes.default_url_options[:host] = ENV["MAILER_HOST"]#Rails.application.secrets.mailer_host
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: ENV["GMAIL_DOMAIN"],#Rails.application.secrets.gmail_domain,
authentication: :plain,
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],#Rails.application.secrets.gmail_username,
password: ENV["GMAIL_PASSWORD"]#Rails.application.secrets.gmail_password
}
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ActiveSupport::Logger::Formatter.new
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
config.active_record.dump_schema_after_migration = false
Elasticsearch::Model.client = Elasticsearch::Client.new host: ENV['SEARCHBOX_SSL_URL']
end
As you can see, I originally tried accessing the environment variables from the secrets file (which contained the environment variable names and referred back to Heroku's config settings but have since tried adding the variables directly to the configuration files themselves. Pushing these new changes to Heroku hasn't made much of a difference however.
config/initializers/devise.rb
Devise.setup do |config|
config.mailer_sender = ENV["MAILER_FROM"]
config.mailer = 'Devise::Mailer'
config.parent_mailer = 'ActionMailer::Base'
require 'devise/orm/active_record'
config.authentication_keys = [:email]
config.strip_whitespace_keys = [:email]
config.http_authenticatable = false
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 11
config.confirmation_keys = [:email]
config.password_length = 6..128
config.email_regexp = /\A[^#\s]+#[^#\s]+\z/
config.reset_password_within = 6.hours
config.sign_out_via = :delete
config.omniauth :twitter, ENV["TWITTER_APP_ID"], ENV["TWITTER_APP_SECRET"]# Rails.application.secrets.twitter_app_id, Rails.application.secrets.twitter_app_secret
config.omniauth :facebook, ENV["FACEBOOK_APP_ID"], ENV["FACEBOOK_APP_SECRET"]# Rails.application.secrets.facebook_app_id, Rails.application.secrets.facebook_app_secret
config.omniauth :instagram, ENV["INSTAGRAM_APP_ID"], ENV["INSTAGRAM_APP_SECRET"]# Rails.application.secrets.instagram_app_id, Rails.application.secrets.instagram_app_secret
end
Devise routes
devise_scope :squatter do
devise_for :squatters, controllers: {
sessions: "squatters/sessions",
registrations: "squatters/registrations",
passwords: "squatters/passwords",
confirmations: "squatters/confirmations",
omniauth_callbacks: "squatters/omniauth_callbacks"
}
end
resources :squatters, only: [:index, :show] do
member do
get :submissions_pending_approval
end
resources :messages, except: [:destroy, :edit, :index]
end
Devise settings for the model I'm using
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:confirmable, :omniauthable, omniauth_providers: [:facebook, :twitter, :instagram]
Most of my devise controllers call super on the controller they inherit from. The only one I've changed is the Omniauth one. I was mostly just following a tutorial for multiple omniauth identities (sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin) so this might be a red herring.
class Squatters::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def self.provides_callback_for(provider)
class_eval %Q{
def #{provider}
#squatter = Squatter.find_for_oauth(env["omniauth.auth"], current_squatter)
if #squatter.persisted?
sign_in_and_redirect #squatter, event: :authentication
set_flash_message(:notice, :success, kind: "#{provider}".capitalize) if is_navigational_format?
else
session["devise.#{provider}_data"] = env["omniauth.auth"]
redirect_to new_squatter_registration_url
end
end
}
end
[:twitter, :facebook, :instagram].each do |provider|
provides_callback_for provider
end
def after_sign_in_path_for(resource)
if resource.email_verified?
super resource
else
finish_signup_path(resource)
end
end
end
As mentioned earlier, I've tried running heroku run rake db:migrate --app my_apps_name and tried running heroku restart --app my_apps_name. Does anyone know if there's something that I might have missed or if this would simply indicate the presence of a bug in the latest version of Devise?
Hi did you check your config/environments folder? You have the production.rb and development.rb files there. When you installed devise, you are made to include this config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } in your development.rb file, this is for sending password confirmation link and reset password link.
Did you include this same in your production.rb file? If you are hosting on heroku, it should be the link of your app.
Please try this config in your heroku app.
config.action_mailer.default_url_options = { :host => 'myapp.herokuapp.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "myapp.herokuapp.com",
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],
password: ENV["GMAIL_PASSWORD"]
}
My error was caused by the Searchkick gem which doesn't work with the trial version of the Searchbox addon in Heroku. I only noticed when I tried to add the secret_key_base environment variable to Devise's initializer file and started to see a reindexing error in Heroku's logs when I tried to reset a password. Commenting out the searchkick line in my models resolved the problem and I can now log in, &c.

Error TypeError: can't dup NilClass - Stripe

I am getting an error ERROR TypeError: can't dup NilClass when processing a Strip charge. I have followed the rails stripe integration documentation.
The error from the terminal is:
Started POST "/charges" for ::1 at 2016-05-27 12:35:48 +0100
Processing by ChargesController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"URydkbi6DghMZnzVqbf79KU+YRy/T+9g3UQ8tO8HTXG4uqvEMzdm6V/EjseNiZiIPS3ziOJJTpJ1K+gGMipksg==", "stripeToken"=>"tok_18FjA2JxArkI2Z35Q4MB3sCE", "stripeTokenType"=>"card", "stripeEmail"=>"fergusmorton#live.com"}
[2016-05-27 12:35:48] ERROR TypeError: can't dup NilClass
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httprequest.rb:392:in `dup'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httprequest.rb:392:in `meta_vars'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:59:in `service'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
Completed 500 Internal Server Error in 55ms (ActiveRecord: 0.0ms)
Net::HTTPFatalError (500 "Internal Server Error "):
app/controllers/charges_controller.rb:9:in `create'
Net::HTTPFatalError: 500 "Internal Server Error "
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http/response.rb:119:in `error!'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http/response.rb:128:in `value'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:915:in `connect'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:852:in `start'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rest-client-1.8.0-x86-mingw32/lib/restclient/request.rb:413:in `transmit'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rest-client-1.8.0-x86-mingw32/lib/restclient/request.rb:176:in `execute'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rest-client-1.8.0-x86-mingw32/lib/restclient/request.rb:41:in `execute'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/stripe-1.43.0/lib/stripe.rb:298:in `execute_request'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/stripe-1.43.0/lib/stripe.rb:196:in `execute_request_with_rescues'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/stripe-1.43.0/lib/stripe.rb:148:in `request'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/stripe-1.43.0/lib/stripe/api_operations/request.rb:15:in `request'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/stripe-1.43.0/lib/stripe/api_operations/create.rb:5:in `create'
from C:/Users/Fergus/best-ever-me-v-1.1/app/controllers/charges_controller.rb:9:in `create'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/abstract_controller/base.rb:198:in `process_action'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_controller/metal/rendering.rb:10:in `process_action'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:117:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:117:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:505:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:505:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:81:in `run_callbacks'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/abstract_controller/callbacks.rb:19:in `process_action'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_controller/metal/rescue.rb:29:in `process_action'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/notifications.rb:164:in `block in instrument'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/notifications.rb:164:in `instrument'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/abstract_controller/base.rb:137:in `process'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionview-4.2.5/lib/action_view/rendering.rb:30:in `process'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_controller/metal.rb:196:in `dispatch'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_controller/metal.rb:237:in `block in action'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/routing/route_set.rb:76:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/routing/route_set.rb:45:in `serve'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/journey/router.rb:43:in `block in serve'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/journey/router.rb:30:in `each'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/journey/router.rb:30:in `serve'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/routing/route_set.rb:817:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/etag.rb:24:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/conditionalget.rb:38:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/flash.rb:260:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in `context'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/cookies.rb:560:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/query_cache.rb:36:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:377:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:81:in `run_callbacks'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/reloader.rb:73:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/web-console-2.3.0/lib/web_console/middleware.rb:28:in `block in call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `catch'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.5/lib/rails/rack/logger.rb:38:in `call_app'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.5/lib/rails/rack/logger.rb:20:in `block in call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/tagged_logging.rb:26:in `tagged'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/tagged_logging.rb:68:in `tagged'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.5/lib/rails/rack/logger.rb:20:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/static.rb:116:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.5/lib/rails/engine.rb:518:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.5/lib/rails/application.rb:165:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
charges_controller.rb
class ChargesController < ApplicationController
def new
end
def create
# Amount in cents
#amount = 500
customer = Stripe::Customer.create(
:email => params[:stripeEmail],
:source => params[:stripeToken]
)
charge = Stripe::Charge.create(
:customer => customer.id,
:amount => #amount,
:description => 'Rails Stripe customer',
:currency => 'usd'
)
rescue Stripe::CardError => e
flash[:error] = e.message
redirect_to new_charge_path
end
end
initiliazers/stripe.rb
Rails.configuration.stripe = {
:publishable_key => ENV['PUBLISHABLE_KEY'],
:secret_key => ENV['SECRET_KEY']
}
Stripe.api_key = Rails.configuration.stripe[:secret_key]
cart/show.html.erb
<div class="shopping-cart" style="margin-top:160px;">
<%= render "shopping_cart" %>
<%= form_tag charges_path do %>
<article>
<% if flash[:error].present? %>
<div id="error_explanation">
<p><%= flash[:error] %></p>
</div>
<% end %>
<label class="amount">
<span>Amount: €<%= current_order.subtotal %> </span>
</label>
</article>
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="<%= Rails.configuration.stripe[:publishable_key] %>"
data-description="Cart Total"
data-amount="<%= current_order.subtotal %>"
data-locale="auto"></script>
<% end %>
</div>
Updated log Following Michael's Suggestions.
Started POST "/charges" for ::1 at 2016-05-31 11:45:45 +0100
Processing by ChargesController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"qXPL5OhG1UA+Ui4uyB7+80/UGDGXFPnOevOf/kmZhitA1f2xY8u9oS3w3DzsIJ2P18eKpcoSWDzSnEtMlLSv6A==", "stripeToken"=>"tok_18HANXJxArkI2Z35encjc3uW", "stripeTokenType"=>"card", "stripeEmail"=>"fergusmorton#live.com"}
Unpermitted parameters: utf8, authenticity_token, stripeTokenType
Completed 500 Internal Server Error in 6ms (ActiveRecord: 0.0ms)
NoMethodError (undefined method `stripe_customer_id' for nil:NilClass):
app/controllers/charges_controller.rb:15:in `create'
NoMethodError: undefined method `stripe_customer_id' for nil:NilClass
From the code that you've shown, it looks like you may have a couple of issues, but there may be additional issues related to setup for Stripe Payment.
The process for setting up Stripe within your application is covered here.
Setup Stripe in your Application
Add Stripe keys to your config/secrets.yml file:
development:
stripe_private_key: <%= ENV["STRIPE_PRIVATE_KEY"] %>
stripe_public_key: <%= ENV["STRIPE_PUBLIC_KEY"] %>
You can keep the STRIPE_PRIVATE_KEY and STRIPE_PUBLIC_KEY in your environment. Test and production environments would require similar configuration settings.
Make certain to add this code to your controller, or in any code that you intend to use the Stripe API:
require "stripe"
Stripe.api_key = Rails.application.secrets.stripe_private_key
Add a Migration to Add Stripe Customer ID to Customer
This migration provides an example based on a User class; your application may use a different model, so adjust as necessary to fit your purpose.
class AddUserStripeCustomerId < ActiveRecord::Migration
def change
change_table :users do |t|
t.string :stripe_customer_id, limit: 50, null: true
end
end
end
Create a Customer
When you're ready to begin the billing process for a customer, create the customer:
if !#user.stripe_customer_id
customer = Stripe::Customer.create(
:email => stripe_details[:stripeEmail],
:source => stripe_details[:stripeToken]
)
User.update(stripe_customer_id: customer)
end
Make sure to save the customer ID in your User model. You'll need to take care to not re-create and overwrite your customer ID for a user, because this is your tie-in to the Stripe payments system for that user.
Implement the Controller
The form elements (parameters) that you're submitting aren't scoped like a Rails model-based form. Typically, this is due to using a form_tag for a form that's not based directly on a model. This means that instead of having parameters scoped by a model hash, the parameters are unscoped.
Your strong parameters aren't included here, but they may be part of the issue. Make sure that you have the stripeToken and stripeEmail included in the permit list, like so:
params.permit(:stripeToken, :stripeCard, :stripeEmail)
Make certain to not include the typical require method on the strong parameters, as that validates that the parameters are scoped by a model object. In your create method, you should call the strong parameters method, and use the result, like so:
require "stripe"
class ChargesController < ApplicationController
Stripe.api_key = Rails.application.secrets.stripe_private_key
def new
end
def create
# Amount in cents
#amount = 500
stripe_details = stripe_params
if !#user.stripe_customer_id
customer = Stripe::Customer.create(
:email => stripe_details[:stripeEmail],
:source => stripe_details[:stripeToken]
)
User.update(stripe_customer_id: customer)
end
charge = Stripe::Charge.create(
:customer => customer.id,
:amount => #amount,
:description => 'Rails Stripe customer',
:currency => 'usd'
)
rescue Stripe::CardError => e
flash[:error] = e.message
redirect_to new_charge_path
end
private
def stripe_params
params.permit(:stripeToken, :stripeCard, :stripeEmail)
end
end
More Information
Also check out How to create a charge and a customer in Stripe (Rails) for additional details on managing customer accounts and charges with Stripe.

Rails 3.2 activerecord cookies throwing error

Occasionally on my local computer, when importing database dump from my production database, I get this when trying to log in:
ActiveRecord::StatementInvalid - PG::SyntaxError: ERROR: zero-length delimited identifier at or near """"
LINE 5: ..." = '2015-12-21 02:17:25.574627' WHERE "sessions"."" = 40276...
^
: UPDATE "sessions" SET "data" = 'some data I removed=
', "updated_at" = '2015-12-21 02:17:25.574627' WHERE "sessions"."" = 402761:
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract_adapter.rb:291:in `translate_exception'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/postgresql_adapter.rb:1155:in `translate_exception'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract_adapter.rb:284:in `rescue in log'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `log'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/postgresql_adapter.rb:670:in `exec_delete'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract/database_statements.rb:96:in `update'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `update'
(gem) activerecord-3.2.22/lib/active_record/persistence.rb:359:in `update'
(gem) activerecord-3.2.22/lib/active_record/locking/optimistic.rb:68:in `update'
(gem) activerecord-3.2.22/lib/active_record/attribute_methods/dirty.rb:74:in `update'
(gem) activerecord-3.2.22/lib/active_record/timestamp.rb:71:in `update'
(gem) activerecord-3.2.22/lib/active_record/callbacks.rb:272:in `block in update'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:403:in `_run__115690163__update__488215436__callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:405:in `__run_callback'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:385:in `_run_update_callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:81:in `run_callbacks'
(gem) activerecord-3.2.22/lib/active_record/callbacks.rb:272:in `update'
(gem) activerecord-3.2.22/lib/active_record/persistence.rb:348:in `create_or_update'
(gem) activerecord-3.2.22/lib/active_record/callbacks.rb:264:in `block in create_or_update'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:425:in `_run__115690163__save__488215436__callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:405:in `__run_callback'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:81:in `run_callbacks'
(gem) activerecord-3.2.22/lib/active_record/callbacks.rb:264:in `create_or_update'
(gem) activerecord-3.2.22/lib/active_record/persistence.rb:84:in `save'
(gem) activerecord-3.2.22/lib/active_record/validations.rb:50:in `save'
(gem) activerecord-3.2.22/lib/active_record/attribute_methods/dirty.rb:22:in `save'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:208:in `transaction'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:259:in `block in save'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:258:in `save'
(gem) activerecord-3.2.22/lib/active_record/session_store.rb:323:in `block in set_session'
(gem) activesupport-3.2.22/lib/active_support/benchmarkable.rb:50:in `silence'
(gem) activerecord-3.2.22/lib/active_record/session_store.rb:320:in `set_session'
(gem) rack-1.4.7/lib/rack/session/abstract/id.rb:327:in `commit_session'
(gem) rack-1.4.7/lib/rack/session/abstract/id.rb:211:in `context'
(gem) rack-1.4.7/lib/rack/session/abstract/id.rb:205:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/cookies.rb:341:in `call'
(gem) activerecord-3.2.22/lib/active_record/query_cache.rb:64:in `call'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:405:in `_run__649130748__call__488215436__callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:405:in `__run_callback'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:81:in `run_callbacks'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/reloader.rb:65:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
(gem) better_errors-0.8.0/lib/better_errors/middleware.rb:84:in `protected_app_call'
(gem) better_errors-0.8.0/lib/better_errors/middleware.rb:79:in `better_errors_call'
(gem) better_errors-0.8.0/lib/better_errors/middleware.rb:56:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
(gem) railties-3.2.22/lib/rails/rack/logger.rb:32:in `call_app'
(gem) railties-3.2.22/lib/rails/rack/logger.rb:16:in `block in call'
(gem) activesupport-3.2.22/lib/active_support/tagged_logging.rb:22:in `tagged'
(gem) railties-3.2.22/lib/rails/rack/logger.rb:16:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/request_id.rb:22:in `call'
(gem) rack-1.4.7/lib/rack/methodoverride.rb:21:in `call'
(gem) rack-1.4.7/lib/rack/runtime.rb:17:in `call'
(gem) activesupport-3.2.22/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
(gem) rack-1.4.7/lib/rack/lock.rb:15:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/static.rb:83:in `call'
(gem) railties-3.2.22/lib/rails/engine.rb:484:in `call'
(gem) railties-3.2.22/lib/rails/application.rb:231:in `call'
(gem) rack-1.4.7/lib/rack/content_length.rb:14:in `call'
(gem) railties-3.2.22/lib/rails/rack/log_tailer.rb:17:in `call'
(gem) thin-1.6.4/lib/thin/connection.rb:86:in `block in pre_process'
(gem) thin-1.6.4/lib/thin/connection.rb:84:in `pre_process'
(gem) thin-1.6.4/lib/thin/connection.rb:53:in `process'
(gem) thin-1.6.4/lib/thin/connection.rb:39:in `receive_data'
(gem) eventmachine-1.0.8/lib/eventmachine.rb:193:in `run'
(gem) thin-1.6.4/lib/thin/backends/base.rb:73:in `start'
(gem) thin-1.6.4/lib/thin/server.rb:162:in `start'
(gem) rack-1.4.7/lib/rack/handler/thin.rb:13:in `run'
(gem) rack-1.4.7/lib/rack/server.rb:268:in `start'
(gem) railties-3.2.22/lib/rails/commands/server.rb:70:in `start'
(gem) railties-3.2.22/lib/rails/commands.rb:55:in `block in <top (required)>'
(gem) railties-3.2.22/lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `<main>'
So I clear the database of sessions (rails dbconsole and delete from sessions;)
But then the error becomes
ActiveRecord::StatementInvalid - PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint
DETAIL: Failing row contains (null, 4cb13a797731260dad7f93297f64b0a6, BAh7AA==
, 2015-12-21 02:53:30.976481, 2015-12-21 02:53:30.976481).
: INSERT INTO "sessions" ("created_at", "data", "id", "session_id", "updated_at") VALUES ($1, $2, $3, $4, $5):
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract_adapter.rb:291:in `translate_exception'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/postgresql_adapter.rb:1155:in `translate_exception'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract_adapter.rb:284:in `rescue in log'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `log'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/postgresql_adapter.rb:659:in `exec_query'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract/database_statements.rb:63:in `exec_insert'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract/database_statements.rb:90:in `insert'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
(gem) activerecord-3.2.22/lib/active_record/relation.rb:66:in `insert'
(gem) activerecord-3.2.22/lib/active_record/persistence.rb:367:in `create'
(gem) activerecord-3.2.22/lib/active_record/timestamp.rb:58:in `create'
(gem) activerecord-3.2.22/lib/active_record/callbacks.rb:268:in `block in create'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:403:in `_run__58360460__create__915097608__callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:405:in `__run_callback'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:81:in `run_callbacks'
(gem) activerecord-3.2.22/lib/active_record/callbacks.rb:268:in `create'
(gem) activerecord-3.2.22/lib/active_record/persistence.rb:348:in `create_or_update'
(gem) activerecord-3.2.22/lib/active_record/callbacks.rb:264:in `block in create_or_update'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:425:in `_run__58360460__save__915097608__callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:405:in `__run_callback'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:81:in `run_callbacks'
(gem) activerecord-3.2.22/lib/active_record/callbacks.rb:264:in `create_or_update'
(gem) activerecord-3.2.22/lib/active_record/persistence.rb:84:in `save'
(gem) activerecord-3.2.22/lib/active_record/validations.rb:50:in `save'
(gem) activerecord-3.2.22/lib/active_record/attribute_methods/dirty.rb:22:in `save'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:208:in `transaction'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:259:in `block in save'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
(gem) activerecord-3.2.22/lib/active_record/transactions.rb:258:in `save'
(gem) activerecord-3.2.22/lib/active_record/session_store.rb:323:in `block in set_session'
(gem) activesupport-3.2.22/lib/active_support/benchmarkable.rb:50:in `silence'
(gem) activerecord-3.2.22/lib/active_record/session_store.rb:320:in `set_session'
(gem) rack-1.4.7/lib/rack/session/abstract/id.rb:327:in `commit_session'
(gem) rack-1.4.7/lib/rack/session/abstract/id.rb:211:in `context'
(gem) rack-1.4.7/lib/rack/session/abstract/id.rb:205:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/cookies.rb:341:in `call'
(gem) activerecord-3.2.22/lib/active_record/query_cache.rb:64:in `call'
(gem) activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:405:in `_run__42731031__call__915097608__callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:405:in `__run_callback'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
(gem) activesupport-3.2.22/lib/active_support/callbacks.rb:81:in `run_callbacks'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/reloader.rb:65:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
(gem) better_errors-0.8.0/lib/better_errors/middleware.rb:84:in `protected_app_call'
(gem) better_errors-0.8.0/lib/better_errors/middleware.rb:79:in `better_errors_call'
(gem) better_errors-0.8.0/lib/better_errors/middleware.rb:56:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
(gem) railties-3.2.22/lib/rails/rack/logger.rb:32:in `call_app'
(gem) railties-3.2.22/lib/rails/rack/logger.rb:16:in `block in call'
(gem) activesupport-3.2.22/lib/active_support/tagged_logging.rb:22:in `tagged'
(gem) railties-3.2.22/lib/rails/rack/logger.rb:16:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/request_id.rb:22:in `call'
(gem) rack-1.4.7/lib/rack/methodoverride.rb:21:in `call'
(gem) rack-1.4.7/lib/rack/runtime.rb:17:in `call'
(gem) activesupport-3.2.22/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
(gem) rack-1.4.7/lib/rack/lock.rb:15:in `call'
(gem) actionpack-3.2.22/lib/action_dispatch/middleware/static.rb:83:in `call'
(gem) railties-3.2.22/lib/rails/engine.rb:484:in `call'
(gem) railties-3.2.22/lib/rails/application.rb:231:in `call'
(gem) rack-1.4.7/lib/rack/content_length.rb:14:in `call'
(gem) railties-3.2.22/lib/rails/rack/log_tailer.rb:17:in `call'
(gem) thin-1.6.4/lib/thin/connection.rb:86:in `block in pre_process'
(gem) thin-1.6.4/lib/thin/connection.rb:84:in `pre_process'
(gem) thin-1.6.4/lib/thin/connection.rb:53:in `process'
(gem) thin-1.6.4/lib/thin/connection.rb:39:in `receive_data'
(gem) eventmachine-1.0.8/lib/eventmachine.rb:193:in `run'
(gem) thin-1.6.4/lib/thin/backends/base.rb:73:in `start'
(gem) thin-1.6.4/lib/thin/server.rb:162:in `start'
(gem) rack-1.4.7/lib/rack/handler/thin.rb:13:in `run'
(gem) rack-1.4.7/lib/rack/server.rb:268:in `start'
(gem) railties-3.2.22/lib/rails/commands/server.rb:70:in `start'
(gem) railties-3.2.22/lib/rails/commands.rb:55:in `block in <top (required)>'
(gem) railties-3.2.22/lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `<main>'
Not sure what causes it and usually I'm good for another dump import and usually the problem vanish.
My session_store.rb looks like this:
MyApp::Application.config.session_store :active_record_store, key: 'my_session_name', :domain => :all
The migration file to create the cookies session:
class AddSessionsTable < ActiveRecord::Migration
def change
create_table :sessions do |t|
t.string :session_id, :null => false
t.text :data
t.timestamps
end
add_index :sessions, :session_id
add_index :sessions, :updated_at
end
end
Because I can't explain why things don't work AND can't fix it unless I do another import, I'm wary of deleting old sessions in production.

sonar -> new critical link -> error

Sonar Version: 4.5.5
Clicking on new critical leads to the following error message:
In the sonar log the following error is reported:
2015.10.05 14:45:32 ERROR web[o.s.s.ui.JRubyFacade] Fail to render: http://sonar.intern/drilldown/measures/39596?metric=new_critical_violations&period=1
private method `gsub' called for 1:Fixnum
On line #127 of app/views/drilldown/measures.html.erb
124: metric: ''null,
125: rule: null,
126: severity: null,
127: period: null
128: };
129:
130:
gems/gems/actionpack-2.3.15/lib/action_view/helpers/javascript_helper.rb:143:in `escape_javascript'
app/views/drilldown/measures.html.erb:127
org/jruby/RubyKernel.java:2227:in `send'
gems/gems/actionpack-2.3.15/lib/action_view/renderable.rb:34:in `render'
gems/gems/actionpack-2.3.15/lib/action_view/base.rb:306:in `with_template'
gems/gems/actionpack-2.3.15/lib/action_view/renderable.rb:30:in `render'
gems/gems/actionpack-2.3.15/lib/action_view/template.rb:205:in `render_template'
gems/gems/actionpack-2.3.15/lib/action_view/base.rb:265:in `render'
gems/gems/actionpack-2.3.15/lib/action_view/base.rb:348:in `_render_with_layout'
gems/gems/actionpack-2.3.15/lib/action_view/base.rb:346:in `_render_with_layout'
gems/gems/actionpack-2.3.15/lib/action_view/base.rb:262:in `render'
gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:1252:in `render_for_file'
gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:936:in `render'
gems/gems/actionpack-2.3.15/lib/action_controller/benchmarking.rb:51:in `render_with_benchmark'
gems/gems/actionpack-2.3.15/lib/action_controller/benchmarking.rb:51:in `render_with_benchmark'
gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:1328:in `default_render'
gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:1334:in `perform_action'
gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb:617:in `call_filters'
gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb:610:in `perform_action_with_filters'
gems/gems/actionpack-2.3.15/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
gems/gems/actionpack-2.3.15/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
gems/gems/actionpack-2.3.15/lib/action_controller/rescue.rb:160:in `perform_action_with_rescue'
gems/gems/actionpack-2.3.15/lib/action_controller/flash.rb:151:in `perform_action_with_flash'
org/jruby/RubyKernel.java:2223:in `send'
gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:532:in `process'
gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb:606:in `process_with_filters'
gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:391:in `process'
gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:386:in `call'
gems/gems/actionpack-2.3.15/lib/action_controller/routing/route_set.rb:450:in `call'
gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:87:in `dispatch'
gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:85:in `dispatch'
gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:121:in `_call'
gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
org/jruby/RubyProc.java:290:in `call'
org/jruby/RubyProc.java:224:in `call'
gems/gems/activerecord-2.3.15/lib/active_record/query_cache.rb:29:in `call'
gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
gems/gems/activerecord-2.3.15/lib/active_record/query_cache.rb:9:in `cache'
gems/gems/activerecord-2.3.15/lib/active_record/query_cache.rb:28:in `call'
gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
gems/gems/actionpack-2.3.15/lib/action_controller/string_coercion.rb:25:in `call'
gems/gems/actionpack-2.3.15/lib/action_controller/params_parser.rb:15:in `call'
file:/opt/sonarqube-4.5.5/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/session_store.rb:70:in `context'
gems/gems/actionpack-2.3.15/lib/action_controller/failsafe.rb:26:in `call'
gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:106:in `call'
file:/opt/sonarqube-4.5.5/lib/server/jruby-rack-1.1.13.2.jar!/rack/adapter/rails.rb:34:in `serve_rails'
file:/opt/sonarqube-4.5.5/lib/server/jruby-rack-1.1.13.2.jar!/rack/adapter/rails.rb:39:in `call'
file:/opt/sonarqube-4.5.5/lib/server/jruby-rack-1.1.13.2.jar!/rack/handler/servlet.rb:22:in `call'
How can this be fixed? Is this a bug? i tried to post in the sonar google group but didn't succeed.
according to Simon BRANDHOF from sonar source. This is a regression and will be fixed in 4.5.6 (see https://jira.sonarsource.com/browse/SONAR-6814)

How to tell if heroku is pushing the correct files

I think I am pushing my master branch to heroku, but when I visit the page none of the file structure is there. For example if I visit http://heroku-site/pages/home I get a "We're sorry but something wen't wrong error" The app works fine locally. How do I know the files are up there. Here are my steps. Not sure why it's not working.
1) git status
2) git add .
3) git commit -m "Some Message"
4) git push heroku master
Heroku logs
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/actionpack-3.2.1/lib/action_dispatch/middleware/static.rb:53:in `call'
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:132:in `forward'
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:181:in `lookup'
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:65:in `call!'
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/railties-3.2.1/lib/rails/application.rb:220:in `call'
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
2012-02-03T02:44:22+00:00 app[web.1]: /home/heroku_rack/lib/static_assets.rb:9:in `call'
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:50:in `call'
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:479:in `call'
2012-02-03T02:44:22+00:00 app[web.1]: /home/heroku_rack/lib/last_access.rb:15:in `call'
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:134:in `call'
2012-02-03T02:44:22+00:00 heroku[router]: GET quiet-flower-7747.heroku.com/pages/home dyno=web.1 queue=0 wait=0ms service=8ms status=500 bytes=643
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:64:in `block in call'
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:49:in `each'
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:49:in `call'
2012-02-03T02:44:22+00:00 app[web.1]: /home/heroku_rack/lib/date_header.rb:14:in `call'
2012-02-03T02:44:22+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:134:in `call'
2012-02-03T02:44:22+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:76:in `block in pre_process'
2012-02-03T02:44:22+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:74:in `catch'
2012-02-03T02:44:22+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:57:in `process'
2012-02-03T02:44:22+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:42:in `receive_data'
2012-02-03T02:44:22+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:74:in `pre_process'
2012-02-03T02:44:22+00:00 app[web.1]: eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
2012-02-03T02:44:22+00:00 app[web.1]: thin (1.2.6) lib/thin/backends/base.rb:57:in `start'
2012-02-03T02:44:22+00:00 app[web.1]: thin (1.2.6) lib/thin/server.rb:156:in `start'
2012-02-03T02:44:22+00:00 app[web.1]: thin (1.2.6) lib/thin/controllers/controller.rb:80:in `start'
2012-02-03T02:44:22+00:00 app[web.1]: thin (1.2.6) lib/thin/runner.rb:177:in `run_command'
2012-02-03T02:44:22+00:00 app[web.1]: thin (1.2.6) lib/thin/runner.rb:143:in `run!'
2012-02-03T02:44:22+00:00 app[web.1]: thin (1.2.6) bin/thin:6:in `<top (required)>'
2012-02-03T02:44:22+00:00 app[web.1]: /usr/ruby1.9.2/bin/thin:19:in `load'
2012-02-03T02:44:22+00:00 app[web.1]: /usr/ruby1.9.2/bin/thin:19:in `<main>'
2012-02-03T02:44:22+00:00 app[web.1]:
2012-02-03T02:44:22+00:00 app[web.1]: eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
2012-02-03T02:44:22+00:00 app[web.1]:
2012-02-03T02:44:22+00:00 app[web.1]: cache: [GET /pages/home] miss
2012-02-03T02:44:22+00:00 heroku[nginx]: 24.87.81.230 - - [03/Feb/2012:02:44:22 +0000] "GET /pages/home HTTP/1.1" 500 643 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.52.7 (KHTML, like Gecko) Version/5.1.2 Safari/534.52.7" quiet-flower-7747.heroku.com
2012-02-03T02:46:45+00:00 app[web.1]:
2012-02-03T02:46:45+00:00 app[web.1]:
2012-02-03T02:46:45+00:00 app[web.1]: Started GET "/pages/home" for 24.87.81.230 at 2012-02-02 18:46:45 -0800
2012-02-03T02:46:45+00:00 app[web.1]:
2012-02-03T02:46:45+00:00 app[web.1]: ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished):
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `retrieve_connection'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/query_cache.rb:67:in `rescue in call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/query_cache.rb:61:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/actionpack-3.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405:in `_run__2584572968946772396__call__962583124295019556__callbacks'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405:in `__run_callback'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/actionpack-3.2.1/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/actionpack-3.2.1/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/actionpack-3.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/actionpack-3.2.1/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/railties-3.2.1/lib/rails/rack/logger.rb:26:in `call_app'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/railties-3.2.1/lib/rails/rack/logger.rb:16:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/actionpack-3.2.1/lib/action_dispatch/middleware/request_id.rb:22:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:132:in `forward'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:50:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/actionpack-3.2.1/lib/action_dispatch/middleware/static.rb:53:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:181:in `lookup'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:479:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/railties-3.2.1/lib/rails/application.rb:220:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:241:in `fetch'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:65:in `call!'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
2012-02-03T02:46:45+00:00 app[web.1]: /home/heroku_rack/lib/static_assets.rb:9:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: /home/heroku_rack/lib/last_access.rb:15:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:134:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:64:in `block in call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:49:in `each'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:49:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: /home/heroku_rack/lib/date_header.rb:14:in `call'
2012-02-03T02:46:45+00:00 app[web.1]: .bundle/gems/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:134:in `call'
2012-02-03T02:46:45+00:00 heroku[router]: GET quiet-flower-7747.heroku.com/pages/home dyno=web.1 queue=0 wait=0ms service=11ms status=500 bytes=643
2012-02-03T02:46:45+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:74:in `catch'
2012-02-03T02:46:45+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:74:in `pre_process'
2012-02-03T02:46:45+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:57:in `process'
2012-02-03T02:46:45+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:42:in `receive_data'
2012-02-03T02:46:45+00:00 app[web.1]: eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
2012-02-03T02:46:45+00:00 app[web.1]: eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
2012-02-03T02:46:45+00:00 app[web.1]: thin (1.2.6) lib/thin/backends/base.rb:57:in `start'
2012-02-03T02:46:45+00:00 app[web.1]: thin (1.2.6) lib/thin/server.rb:156:in `start'
2012-02-03T02:46:45+00:00 app[web.1]: thin (1.2.6) lib/thin/controllers/controller.rb:80:in `start'
2012-02-03T02:46:45+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:76:in `block in pre_process'
2012-02-03T02:46:45+00:00 app[web.1]: thin (1.2.6) bin/thin:6:in `<top (required)>'
2012-02-03T02:46:45+00:00 app[web.1]: thin (1.2.6) lib/thin/runner.rb:143:in `run!'
2012-02-03T02:46:45+00:00 app[web.1]: thin (1.2.6) lib/thin/runner.rb:177:in `run_command'
2012-02-03T02:46:45+00:00 app[web.1]:
2012-02-03T02:46:45+00:00 app[web.1]: /usr/ruby1.9.2/bin/thin:19:in `load'
2012-02-03T02:46:45+00:00 app[web.1]: /usr/ruby1.9.2/bin/thin:19:in `<main>'
2012-02-03T02:46:45+00:00 app[web.1]:
2012-02-03T02:46:45+00:00 app[web.1]: cache: [GET /pages/home] miss
2012-02-03T02:46:46+00:00 heroku[nginx]: 24.87.81.230 - - [03/Feb/2012:02:46:46 +0000] "GET /pages/home HTTP/1.1" 500 643 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.52.7 (KHTML, like Gecko) Version/5.1.2 Safari/534.52.7" quiet-flower-7747.heroku.com
Your answer lies here:
ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished):
I notice you're using EventMachine, which then leads me to ask how you're connecting to the database. Ensure that you're using ENV["DATABASE_URL"] as your DB connection.
You can tell if your repository files are up there by cloning from your Heroku git repo to some other directory on your machine and making sure they're all there.
When you say "when I visit the page none of the file structure is there", what do you mean exactly?
If /pages/home is supposed to display the file listing from your file system, then this might not work in Heroku. I know that your Dyno sees a read-only file system and they might be doing some other funny stuff there as well.

Resources