Ruby - exclude a column with activerecord - ruby

I want to exclude a column (called checkdata) in my Check table.
Right now my code looks like this:
ret = Check.joins(:model).get_list do |q|
// some code
end
I tried the following which I found as I was searching for a solution, but it gives me an error:
ret = Check.select(Check.attribute_names - ['checkdata']).joins(:model).get_list do |q|
// some code
end
Error:
E, [2017-02-28T10:45:05.154053 #10874] ERROR -- : SQLite3::SQLException: ambiguous column name: id: SELECT COUNT(id, unit_id, model_id, checktype_id, comment, scheduled, dueby, started, finished, status, metadata, created_at, updated_at, created_by, updated_by) FROM "checks" INNER JOIN "models" ON "models"."id" = "checks"."model_id" WHERE "checks"."status" = 20 2017-02-28 10:45:05 - ActiveRecord::StatementInvalid - SQLite3::SQLException: ambiguous column name: id: SELECT COUNT(id, unit_id, model_id, checktype_id, comment, scheduled, dueby, started, finished, status, metadata, created_at, updated_at, created_by, updated_by) FROM "checks" INNER JOIN "models" ON "models"."id" = "checks"."model_id" WHERE "checks"."status" = 20:
/Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in `initialize'
/Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in `new'
/Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in `prepare'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/sqlite3_adapter.rb:301:in `block in exec_query'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract_adapter.rb:378:in `block in log'
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.16/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract_adapter.rb:372:in `log'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/sqlite3_adapter.rb:298:in `exec_query'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/sqlite3_adapter.rb:510:in `select'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/database_statements.rb:24:in `select_all'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation/calculations.rb:265:in `execute_simple_calculation'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation/calculations.rb:227:in `perform_calculation'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation/calculations.rb:119:in `calculate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation/calculations.rb:34:in `count'
/Users/ndinatale/leanlogic-qa-prototype/server/lib/models_base.rb:135:in `get_list'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation/delegation.rb:94:in `public_send'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation/delegation.rb:94:in `block in method_missing'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation.rb:292:in `scoping'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/relation/delegation.rb:94:in `method_missing'
/Users/ndinatale/leanlogic-qa-prototype/server/lib/routes_dashboard.rb:110:in `dashboard_type_CPCH'
/Users/ndinatale/leanlogic-qa-prototype/server/routes/02_rest_misc.rb:175:in `call'
/Users/ndinatale/leanlogic-qa-prototype/server/routes/02_rest_misc.rb:175:in `block in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in `call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in `block in compile!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `[]'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `block (3 levels) in route!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:994:in `route_eval'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `block (2 levels) in route!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1015:in `block in process_route'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in `catch'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in `process_route'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:973:in `block in route!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in `each'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in `route!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1085:in `block in dispatch!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `block in invoke'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `catch'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `invoke'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1082:in `dispatch!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in `block in call!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `block in invoke'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `catch'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `invoke'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in `call!'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:895:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.5/lib/rack/session/abstract/id.rb:225:in `context'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.5/lib/rack/session/abstract/id.rb:220:in `call'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.1.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.5/lib/rack/nulllogger.rb:9:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.5/lib/rack/head.rb:13:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.5/lib/rack/methodoverride.rb:22:in `call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/show_exceptions.rb:25:in `call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:182:in `call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:2013:in `call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:in `block in call'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1785:in `synchronize'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1785:in `synchronize'
/Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:in `call'
/Library/Ruby/Gems/2.0.0/gems/puma-3.7.0/lib/puma/configuration.rb:226:in `call'
/Library/Ruby/Gems/2.0.0/gems/puma-3.7.0/lib/puma/server.rb:578:in `handle_request'
/Library/Ruby/Gems/2.0.0/gems/puma-3.7.0/lib/puma/server.rb:415:in `process_client'
/Library/Ruby/Gems/2.0.0/gems/puma-3.7.0/lib/puma/server.rb:275:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/puma-3.7.0/lib/puma/thread_pool.rb:120:in `call'
/Library/Ruby/Gems/2.0.0/gems/puma-3.7.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
Can someone help me with this? Thank you.

It looks like a conflict with the join table as they both have id columns. Try this:
cols = (Check.attribute_names - ['checkdata']).map { |attrib| "checks.#{attrib}" }
ret = Check.select(*cols).joins(:model).get_list ...

Related

HTTP Post Request Failing - Ruby Curl

I'm new to Ruby, therefore, not much familiar with the syntaxes -
I want a Ruby code for the following curl request -
curl -X POST http://<auth_server_endpoint>/oauth/token -d "grant_type
=client_credentials" -H"Authorization: Basic encode64Of(clientid:secret)"
After following the link -
How to invoke HTTP POST method over SSL in ruby?
I've written a function to get the response -
def getToken(client_id, secret)
encodedId = Base64.encode64(client_id+":"+secret)
uri = URI.parse("auth_server_endpoint")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new("/oauth/token")
request.add_field('Content-Type', 'application/json')
request.add_field('Authorization', "Basic #{encodedId}")
//FAILS BELOW
response = http.request(request, {'grant_type' => 'client_credentials'})
parsed_json = JSON.parse(response)
self.access_token = parsed_json.fetch("access_token")
self.expires_in = parsed_json.fetch("expires_in")
end
I'm not able to figure out the error. Kindly suggest the changes I need to make.
ERROR LOG -
OpenSSL::SSL::SSLError - SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol:
/netdir/http.rb:920:in `connect'
/netdir/http.rb:920:in `block in connect'
/rubydir/2.1.0/timeout.rb:76:in `timeout'
/netdir/http.rb:920:in `connect'
/netdir/http.rb:863:in `do_start'
/netdir/http.rb:852:in `start'
/netdir/http.rb:1369:in `request'
/rubydir/gems/2.1.0/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
/appdir/lib/sc_customer/auth_token.rb:30:in `getToken'
/appdir/controllers/payment_controller.rb:276:in `block (2 levels) in <module:API>'
/rubydir/gems/2.1.0/gems/rack-metrics-0.0.27/lib/probes/sinatra_probe.rb:24:in `call'
/rubydir/gems/2.1.0/gems/rack-metrics-0.0.27/lib/probes/sinatra_probe.rb:24:in `block in bind'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:569:in `call'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:569:in `block in route'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:51:in `[]'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:51:in `block (3 levels) in process_destination_path'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:851:in `route_eval'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:51:in `block (2 levels) in process_destination_path'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:51:in `catch'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:51:in `block in process_destination_path'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:25:in `instance_eval'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:25:in `process_destination_path'
(eval):16:in `block (2 levels) in inject_root_methods'
(eval):6:in `catch'
(eval):6:in `block in inject_root_methods'
/rubydir/gems/2.1.0/gems/http_router-0.10.2/lib/http_router/node/root.rb:554:in `[]'
/rubydir/gems/2.1.0/gems/http_router-0.10.2/lib/http_router/node/root.rb:13:in `[]'
/rubydir/gems/2.1.0/gems/http_router-0.10.2/lib/http_router.rb:119:in `block in call'
/rubydir/gems/2.1.0/gems/http_router-0.10.2/lib/http_router.rb:119:in `catch'
/rubydir/gems/2.1.0/gems/http_router-0.10.2/lib/http_router.rb:119:in `call'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:910:in `route!'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:900:in `dispatch!'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in `block in call!'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `block in invoke'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `catch'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `invoke'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in `call!'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:755:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/logger.rb:15:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/session/abstract/id.rb:195:in `context'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/session/abstract/id.rb:190:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/head.rb:9:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/methodoverride.rb:24:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/sc_core/logger.rb:58:in `call'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:1389:in `block in call'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:1471:in `synchronize'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:1389:in `call'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/router.rb:83:in `block in call'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/router.rb:76:in `each'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/router.rb:76:in `call'
/rubydir/gems/2.1.0/gems/sc-mq-0.0.86/lib/sc_mq/rack/filter.rb:24:in `call'
/appdir/lib/rack/bu_aware_request_handler.rb:32:in `block in call'
/rubydir/gems/2.1.0/gems/activerecord_use_slave-0.0.5/lib/activerecord_use_slave.rb:44:in `using_connection'
/appdir/lib/rack/bu_aware_request_handler.rb:31:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/rack/connection_release.rb:11:in `call'
/rubydir/gems/2.1.0/gems/rack-metrics-0.0.27/lib/rack-metrics/rack.rb:11:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/rack/serial_initializer.rb:49:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/rack/log_exceptions.rb:11:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/rack/transaction_tracer.rb:23:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/sc_core/rack/filter.rb:14:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/lint.rb:48:in `_call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/lint.rb:36:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/showexceptions.rb:24:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/commonlogger.rb:20:in `call'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:136:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/chunked.rb:41:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/content_length.rb:14:in `call'
/rubydir/gems/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:552:in `process_client'
/rubydir/gems/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:632:in `worker_loop'
/rubydir/gems/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
/rubydir/gems/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:142:in `start'
/rubydir/gems/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `<top (required)>'
/b2cdir/bin/unicorn:16:in `load'
/b2cdir/bin/unicorn:16:in `<main>'
ERROR -17/May/2016 10:56:42 [payment-b2c TXN-af2c9519-6e89-4fa2-8913-ee164f53523d REQ-28485d83-47a3-47cc-814d-993dc544697a] - OpenSSL::SSL::SSLError - SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol:
/netdir/http.rb:920:in `connect'
/netdir/http.rb:920:in `block in connect'
/rubydir/2.1.0/timeout.rb:76:in `timeout'
/netdir/http.rb:920:in `connect'
/netdir/http.rb:863:in `do_start'
/netdir/http.rb:852:in `start'
/netdir/http.rb:1369:in `request'
/rubydir/gems/2.1.0/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
/appdir/lib/sc_customer/auth_token.rb:30:in `getToken'
/appdir/controllers/payment_controller.rb:276:in `block (2 levels) in <module:API>'
/rubydir/gems/2.1.0/gems/rack-metrics-0.0.27/lib/probes/sinatra_probe.rb:24:in `call'
/rubydir/gems/2.1.0/gems/rack-metrics-0.0.27/lib/probes/sinatra_probe.rb:24:in `block in bind'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:569:in `call'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:569:in `block in route'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:51:in `[]'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:51:in `block (3 levels) in process_destination_path'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:851:in `route_eval'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:51:in `block (2 levels) in process_destination_path'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:51:in `catch'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:51:in `block in process_destination_path'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:25:in `instance_eval'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:25:in `process_destination_path'
(eval):16:in `block (2 levels) in inject_root_methods'
(eval):6:in `catch'
(eval):6:in `block in inject_root_methods'
/rubydir/gems/2.1.0/gems/http_router-0.10.2/lib/http_router/node/root.rb:554:in `[]'
/rubydir/gems/2.1.0/gems/http_router-0.10.2/lib/http_router/node/root.rb:13:in `[]'
/rubydir/gems/2.1.0/gems/http_router-0.10.2/lib/http_router.rb:119:in `block in call'
/rubydir/gems/2.1.0/gems/http_router-0.10.2/lib/http_router.rb:119:in `catch'
/rubydir/gems/2.1.0/gems/http_router-0.10.2/lib/http_router.rb:119:in `call'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:910:in `route!'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/application/routing.rb:900:in `dispatch!'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in `block in call!'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `block in invoke'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `catch'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `invoke'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in `call!'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:755:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/logger.rb:15:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/session/abstract/id.rb:195:in `context'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/session/abstract/id.rb:190:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/head.rb:9:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/methodoverride.rb:24:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/sc_core/logger.rb:58:in `call'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:1389:in `block in call'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:1471:in `synchronize'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:1389:in `call'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/router.rb:83:in `block in call'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/router.rb:76:in `each'
/rubydir/gems/2.1.0/gems/padrino-core-0.10.5.patched/lib/padrino-core/router.rb:76:in `call'
/rubydir/gems/2.1.0/gems/sc-mq-0.0.86/lib/sc_mq/rack/filter.rb:24:in `call'
/appdir/lib/rack/bu_aware_request_handler.rb:32:in `block in call'
/rubydir/gems/2.1.0/gems/activerecord_use_slave-0.0.5/lib/activerecord_use_slave.rb:44:in `using_connection'
/appdir/lib/rack/bu_aware_request_handler.rb:31:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/rack/connection_release.rb:11:in `call'
/rubydir/gems/2.1.0/gems/rack-metrics-0.0.27/lib/rack-metrics/rack.rb:11:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/rack/serial_initializer.rb:49:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/rack/log_exceptions.rb:11:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/rack/transaction_tracer.rb:23:in `call'
/rubydir/gems/2.1.0/gems/sc-core-1.1.36/lib/sc_core/rack/filter.rb:14:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/lint.rb:48:in `_call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/lint.rb:36:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/showexceptions.rb:24:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/commonlogger.rb:20:in `call'
/rubydir/gems/2.1.0/gems/sinatra-1.3.3/lib/sinatra/base.rb:136:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/chunked.rb:41:in `call'
/rubydir/gems/2.1.0/gems/rack-1.3.6/lib/rack/content_length.rb:14:in `call'
/rubydir/gems/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:552:in `process_client'
/rubydir/gems/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:632:in `worker_loop'
/rubydir/gems/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
/rubydir/gems/2.1.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:142:in `start'
/rubydir/gems/2.1.0/gems/unicorn-4.6.3/bin/unicorn:126:in `<top (required)>'
/b2cdir/bin/unicorn:16:in `load'
/b2cdir/bin/unicorn:16:in `<main>'
DEBUG -17/May/2016 10:56:42 [payment-b2c TXN-af2c9519-6e89-4fa2-8913-ee164f53523d REQ-28485d83-47a3-47cc-814d-993dc544697a] - POST [1.085s DB: 0.009s ( 0.8%) 7 queries] /payments - 500 Internal Server Error

Ruby Sinatra getting Net::ReadTimeout - Net::ReadTimeout

Bellow are some parts of my code:
class VizApp < Sinatra::Base
get '/rubygems' do
#process_downloads_days = HTTParty.get('http://localhost:4567/api/v1/rubygems/version_downloads_days_process', timeout: 180)
#version_downloads = HTTParty.get('http://localhost:4567/api/v1/rubygems/version_downloads')
#version_downloads_days = HTTParty.get('http://localhost:4567/api/v1/rubygems/version_downloads_days')
#version_downloads_stack = HTTParty.get('http://localhost:4567/api/v1/rubygems/version_downloads_stack')
#version_downloads_nest_drilldown = HTTParty.get('http://localhost:4567/api/v1/rubygems/version_downloads_nest')
erb :rubygems
end
What I do is calling the api that I wrote in the same project. When I using WEBrick as my web server, everything goes ok. However, when I change the web server to Thin, I get following error:
Net::ReadTimeout - Net::ReadTimeout: /Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/protocol.rb:158:in `rescue in rbuf_fill'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/protocol.rb:152:in `rbuf_fill'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/protocol.rb:134:in `readuntil'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/protocol.rb:144:in `readline'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http/response.rb:39:in `read_status_line'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http/response.rb:28:in `read_new'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1423:in `block in transport_request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1420:in `catch'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1420:in `transport_request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1393:in `request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1386:in `block in request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:853:in `start'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1384:in `request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/httparty-0.13.7/lib/httparty/request.rb:117:in `perform'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/httparty-0.13.7/lib/httparty.rb:545:in `perform_request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/httparty-0.13.7/lib/httparty.rb:476:in `get'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/httparty-0.13.7/lib/httparty.rb:583:in `get'
/Users/chenlizhan/Desktop/Lee/Projects/repo-miner/visualization/app.rb:39:in `block in <class:VizApp>'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in `block in compile!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in `[]'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in `block (3 levels) in route!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:993:in `route_eval'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in `block (2 levels) in route!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1014:in `block in process_route'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in `catch'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in `process_route'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:972:in `block in route!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:in `each'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:in `route!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1084:in `block in dispatch!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `block in invoke'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `catch'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `invoke'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1081:in `dispatch!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in `block in call!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `block in invoke'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `catch'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `invoke'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in `call!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:894:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/nulllogger.rb:9:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/show_exceptions.rb:21:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:181:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:2021:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in `block in call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1795:in `synchronize'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/tempfile_reaper.rb:15:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/lint.rb:49:in `_call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/lint.rb:37:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/showexceptions.rb:24:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/commonlogger.rb:33:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/chunked.rb:54:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run_machine'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/handler/thin.rb:19:in `run'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:286:in `start'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:147:in `start'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/bin/rackup:4:in `<top (required)>'
/Users/chenlizhan/.rvm/gems/ruby-head/bin/rackup:23:in `load'
/Users/chenlizhan/.rvm/gems/ruby-head/bin/rackup:23:in `<main>'
/Users/chenlizhan/.rvm/gems/ruby-head/bin/ruby_executable_hooks:15:in `eval'
/Users/chenlizhan/.rvm/gems/ruby-head/bin/ruby_executable_hooks:15:in `<main>'
Anyone has the similar problems as me? Please give me a help, thanks!
I would create a thin.yml file within /config and then set timeout: 90 or play around with a value that you find best.
You can then specify the config file when you execute thin via thin -C config/thin.yml

NoMethodError - undefined method `id' for nil:NilClass:

I have a bunch of numbers in a table with parent/child relationships. I have a column called 'parent_id' that i'm using to match to the parent number's 'id' column. Issue is, i'm getting a NoMethodError - undefined method `id' for nil:NilClass: when trying to find by 'parent_id'
app.rb
number = Number.find_by_twilio_sid(params[:sid])
forward = Number.find_by_parent_id(number.id)
erb "#{forward.name}"
It gets caught up on the second line when I call the id from the found number. Here is the terminal response:
NoMethodError - undefined method `id' for nil:NilClass:
/Users/chadsakonchick/Projects/cloud-phone/lib/voice.rb:52:in `block in <top (required)>'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `block in compile!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `[]'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (3 levels) in route!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:985:in `route_eval'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (2 levels) in route!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1006:in `block in process_route'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `catch'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `process_route'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:964:in `block in route!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `each'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `route!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1076:in `block in dispatch!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1073:in `dispatch!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `block in call!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `call!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:886:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/session/abstract/id.rb:225:in `context'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/session/abstract/id.rb:220:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/logger.rb:15:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/commonlogger.rb:33:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:217:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:210:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/head.rb:13:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/methodoverride.rb:22:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/show_exceptions.rb:21:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/handler/webrick.rb:89:in `service'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
[2014-11-12 22:44:14] ERROR NoMethodError: undefined method `join' for #<String:0x007fd013edcc28>
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/show_exceptions.rb:37:in `rescue in call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/show_exceptions.rb:21:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/handler/webrick.rb:89:in `service'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
localhost - - [12/Nov/2014:22:44:14 CST] "GET /forward/A9R0cadcba83424fdead5602dzQbb83e61 HTTP/1.1" 500 347
- -> /forward/A9R0cadcba83424fdead5602dzQbb83e61
This means there is no entry in you Number table with specified twilio_sid.
there are multiple method to avoid this error:
One is:
number = Number.find_by_twilio_sid(params[:sid])
forward_name = Number.find_by_parent_id(number.try(:id)).try(:name)
erb "#{forward_name}"

Can't successfully find a Twilio subaccount with twilio-rb

Big fan of using twilio-rb over twilio-ruby, but i'm stuck when trying to provide the Twilio subaccount's friendly_name to request the account_sid.
app.rb
Twilio::Config.setup \
:account_sid => '[MAIN ACCOUNT_SID]',
:auth_token => '[AUTH_TOKEN]'
subaccount.rb
post '/subaccount/create' do
Twilio::Account.create :friendly_name => params[:friendly_name]
account = Twilio::Account.find :friendly_name => params[:friendly_name]
#subaccount = Subaccount.new
#subaccount.friendly_name = params[:friendly_name]
#subaccount.account_sid = account.sid
if #subaccount.save
redirect '/subaccount/create'
else
erb 'There has been an error saving.'
end
end
It creates the subaccount in Twilio just fine, it does not however find the subaccount with the friendly_name.
When I break this down further, I have a subaccount named 'hello' and I want the SID for it:
account = Twilio::Account.find :friendly_name => "hello"
puts account.sid
This is what is returned in the Terminal
Called from: /Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/builder.rb:86:in `new'.
URI::InvalidURIError - bad URI(is not URI?): /Accounts/{:friendly_name=>"hello"}.json:
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:176:in `split'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:211:in `parse'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:747:in `parse'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/httparty-0.10.2/lib/httparty/request.rb:44:in `path='
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/httparty-0.10.2/lib/httparty/request.rb:33:in `initialize'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/httparty-0.10.2/lib/httparty.rb:456:in `new'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/httparty-0.10.2/lib/httparty.rb:456:in `perform_request'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/httparty-0.10.2/lib/httparty.rb:398:in `get'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/twilio-rb-2.3.0/lib/twilio/resource.rb:116:in `block (2 levels) in singleton class'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/twilio-rb-2.3.0/lib/twilio/finder.rb:9:in `find'
/Users/chadsakonchick/Projects/cloud-phone/lib/subaccounts.rb:27:in `block in <top (required)>'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `block in compile!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `[]'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (3 levels) in route!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:985:in `route_eval'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (2 levels) in route!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1006:in `block in process_route'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `catch'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `process_route'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:964:in `block in route!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `each'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `route!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1076:in `block in dispatch!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1073:in `dispatch!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `block in call!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `call!'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:886:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/session/abstract/id.rb:225:in `context'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/session/abstract/id.rb:220:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/logger.rb:15:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/commonlogger.rb:33:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:217:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:210:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/head.rb:13:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/methodoverride.rb:22:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/show_exceptions.rb:21:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/handler/webrick.rb:89:in `service'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
[2014-11-07 18:22:32] ERROR NoMethodError: undefined method `join' for #<String:0x007fc7548fa570>
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/show_exceptions.rb:37:in `rescue in call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/show_exceptions.rb:21:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call'
/Users/chadsakonchick/.rvm/gems/ruby-2.1.2/gems/rack-1.6.0.beta/lib/rack/handler/webrick.rb:89:in `service'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/Users/chadsakonchick/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
localhost - - [07/Nov/2014:18:22:32 CST] "GET /subaccount/twilio-rb/hello HTTP/1.1" 500 340
Try this:
account = Twilio::Account.all :friendly_name => "hello"
puts account[0].sid
It took me a few minutes of digging in the twilio-rb gem, it's the Finder class that is being included into the Account class that does the work. In this scenario we want to use the API List resource which Stevie and co supported with the all method with a filter parameter.
Using the find method requires the account SID, and doesn't seem to support parameters. I think it might be worth making a pull request to add this to the documentation, as it's not obvious.
Update
See above as I added the [0] indexer to account as this is an Array.

ActiveRecord::RecordNotFound - Couldn't find Location with id=favicon.ico

I'm running a Sinatra app locally and it works fine but I can't deploy the app to heroku or EC2. I get the following in my log (locally) about the favicon.ico. I've added this file to my app but it still give me this:
ActiveRecord::RecordNotFound - Couldn't find Location with id=favicon.ico
Any ideas on how to fix this?
== Sinatra/1.4.2 has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on localhost:4567, CTRL+C to stop
D, [2013-06-06T20:18:30.470678 #1786] DEBUG -- : Location Load (0.2ms) SELECT "locations".* FROM "locations"
127.0.0.1 - - [06/Jun/2013 20:18:30] "GET / HTTP/1.1" 200 2552 0.0419
D, [2013-06-06T20:18:30.763844 #1786] DEBUG -- : Location Load (0.2ms) SELECT "locations".* FROM "locations" WHERE "locations"."id" = ? LIMIT 1 [["id", "favicon.ico"]]
ActiveRecord::RecordNotFound - Couldn't find Location with id=favicon.ico:
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord- 3.2.13/lib/active_record/relation/finder_methods.rb:343:in `find_one'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:314:in `find_with_ids'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:107:in `find'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/querying.rb:5:in `find'
app.rb:36:in `block in <main>'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1415:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1415:in `block in compile!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `[]'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `block (3 levels) in route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:960:in `route_eval'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `block (2 levels) in route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:981:in `block in process_route'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:979:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:979:in `process_route'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:943:in `block in route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:942:in `each'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:942:in `route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1053:in `block in dispatch!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `block in invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1050:in `dispatch!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:878:in `block in call!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `block in invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:878:in `call!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:864:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/xss_header.rb:18:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/path_traversal.rb:16:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/json_csrf.rb:18:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/frame_options.rb:31:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/logger.rb:15:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/commonlogger.rb:33:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:209:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:202:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/showexceptions.rb:21:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:172:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1947:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1610:in `block in call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1693:in `synchronize'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1610:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/thin-1.5.1/lib/thin/connection.rb:81:in `block in pre_process'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/thin-1.5.1/lib/thin/connection.rb:79:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/thin-1.5.1/lib/thin/connection.rb:79:in `pre_process'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in `block in spawn_threadpool'
Do you have a /:something route that then tries to load a record from the db based on :something. It seems like the browser is asking for /favicon.ico and your app is trying to query the database for a record with id favicon.ico.
Do you have a /:something route, and if so what does it do?

Resources