Rails 3.2 activerecord cookies throwing error - activerecord

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.

Related

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)

LoadError in Users::OmniauthCallbacksController#facebook - Rails 4

well, I am trying to code a system that uses facebook login. When I click on the facebook link it goes to facebook page for authentication and on the callback show me this error: Unable to autoload constant Users::OmniauthCallbacksController, expected path/app/controllers/users/omniauth_callbacks_controller.rb to define it.
I am using devise gem, omniauth gem, ruby 2 and rails 4.
My user_controller.rb
class User::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
#user = User.find_for_facebook_oauth(request.env['omniauth.auth'], current_user)
if #user.persisted?
sign_in_and_redirect #user, :event => :authentication #this will throw if #user is not activated
set_flash_message(:notice, :success, :kind => 'Facebook') if is_navigational_format?
else
session['devise.facebook_data'] = request.env['omniauth.auth']
redirect_to new_user_registration_url
end
end
end
My user.rb
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :omniauthable
def self.find_for_facebook_oauth(auth, signed_in_resource = nil)
user = User.where(:provider => auth.provider, :uid => auth.uid).first
if user
return user
else
registered_user = User.where(:email => auth.info.email).first
if registered_user
return registered_user
else
user = User.create(name:auth.extra.raw_info.name,
provider:auth.provider,
uid:auth.uid,
email:auth.info.email,
password:Devise.friendly_token[0,20],
)
end
end
end
end
On routes.rb I have this line:
devise_for :users, :controllers => { :omniauth_callbacks => 'users/omniauth_callbacks' }
The Full Trace is this:
activesupport (4.0.0) lib/active_support/dependencies.rb:463:in `load_missing_constant'
activesupport (4.0.0) lib/active_support/dependencies.rb:183:in `const_missing'
activesupport (4.0.0) lib/active_support/inflector/methods.rb:228:in `const_get'
activesupport (4.0.0) lib/active_support/inflector/methods.rb:228:in `block in constantize'
activesupport (4.0.0) lib/active_support/inflector/methods.rb:224:in `each'
activesupport (4.0.0) lib/active_support/inflector/methods.rb:224:in `inject'
activesupport (4.0.0) lib/active_support/inflector/methods.rb:224:in `constantize'
activesupport (4.0.0) lib/active_support/dependencies.rb:534:in `get'
activesupport (4.0.0) lib/active_support/dependencies.rb:565:in `constantize'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:76:in `controller_reference'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:66:in `controller'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:44:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/mapper.rb:44:in `call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:401:in `call_app!'
omniauth (1.1.4) lib/omniauth/strategy.rb:363:in `callback_phase'
omniauth-oauth2 (1.1.1) lib/omniauth/strategies/oauth2.rb:77:in `callback_phase'
omniauth (1.1.4) lib/omniauth/strategy.rb:226:in `callback_call'
omniauth (1.1.4) lib/omniauth/strategy.rb:182:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__878755641__call__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0) lib/rails/engine.rb:511:in `call'
railties (4.0.0) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
C:/Development/Ruby200/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
C:/Development/Ruby200/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
C:/Development/Ruby200/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
So that's my problem I hope someone can help me.
EDIT: rather than what I implied to, my callbacks controller is called omniauth_callbacks_controller.rb.
1. As sevenseacat suggested I changed the reference from users to user on my route file, but the problem still happened.
2. As *uno_ordinary* suggested I added :omniauth_providers => :facebook on my model but after that I received a new error when starting the server:
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
C:3:in `rescue in execute_if_updated': Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil: #<Rails::Application::RoutesReloader:0x4375db8 #paths=["C:/Users/Diogo de Lima/Documents/Development/Ruby on Rails/Rhodnius/config/routes.rb"], #route_sets=[#<ActionDispatch::Routing::RouteSet:0x449da98>]> (RuntimeError)
from C:131071:in `execute_if_updated'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/Development/Ruby200/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from C:/Development/Ruby200/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from C:/Development/Ruby200/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from C:/Development/Ruby200/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from C:/Development/Ruby200/lib/ruby/2.0.0/tsort.rb:180:in `each'
from C:/Development/Ruby200/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from C:/Development/Ruby200/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from C:/Users/Diogo de Lima/Documents/Development/Ruby on Rails/Rhodnius/config/environment.rb:5:in `<top (required)>'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from C:/Users/Diogo de Lima/Documents/Development/Ruby on Rails/Rhodnius/config.ru:3:in `block in <main>'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from C:/Users/Diogo de Lima/Documents/Development/Ruby on Rails/Rhodnius/config.ru:in `new'
from C:/Users/Diogo de Lima/Documents/Development/Ruby on Rails/Rhodnius/config.ru:in `<main>'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from C:/Development/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
If your callbacks controller is in a file called user_controller.rb (as your post implies), this is incorrect.
To follow Rails' naming conventions, it needs to be in app/controllers/users/omniauth_callbacks_controller.rb (as the error tells you).
You also have a problem with namespacing - your route for the callbacks controller refers to users (plural), while your controller namespace is User (singular).
Try to add to User model the following:
:omniauthable, :omniauth_providers => [:facebook]

active admin called nil id

im working with active admin i have collection_select or dropdown box that populates the packages and crews im just wondering i why this
undefined method `[]' for nil:NilClass`
i dont know what happened but it run few days ago and tested it once but now it raises this error are there possible way to solve this?
def create
#package = Package.find(params[:package_crew][:package_id])
crew = Crew.find(params[:package_crew][:crew_id] )
#package_crew = #package.add_crew(crew.id)
if #package_crew.save
redirect_to {admin_package_crew_url}
end
end
thanks in advance more power to us all
i tried this
def create
#pid = params[:package_crew][:crew_id] if params[:package_crew]
pid,cid = 2 #tried nil,0..10
if params[:package_crew]
pid = params[:package_crew][:package_id]
cid = params[:package_crew][:crew_id]
end
#package = Package.find_by_id(pid)
crew = Crew.find_by_id(cid)
##package = Package.find(params[:package_crew][:package_id])
#crew = Crew.find(params[:package_crew][:crew_id] )
#package_crew = #package.add_crew(crew.id)
if #package_crew.save
redirect_to {admin_package_crew_url}
end
end
add_crew method
def add_crew(crew_id)
current_package = package_crews.find_by_crew_id(crew_id)
if current_package
current_package.quantity = current_package.quantity.to_i + 1
else
current_package = package_crews.build(:crew_id => crew_id)
current_package.price = current_package.crew.price
end
current_package
end
moving parameters
{"utf8"=>"✓",
"authenticity_token"=>"n4WZpQpES6mnSO12oGKV/MeoxAVvV9OmJQKfhcpnvQM=",
"crew_for_package"=>{"package_id"=>"1",
"crew_id"=>"1",
"quantity"=>"1"},
"commit"=>"Create Package crew"}
stack error
app/admin/package_crews.rb:35:in `create'
actionpack (3.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.1) lib/active_support/callbacks.rb:447:in `_run__304549499__process_action__775442107__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
activerecord (3.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.1) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `dispatch'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:30:in `call'
journey (1.0.3) lib/journey/router.rb:68:in `block in call'
journey (1.0.3) lib/journey/router.rb:56:in `each'
journey (1.0.3) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `call'
sass (3.1.15) lib/sass/plugin/rack.rb:54:in `call'
warden (1.1.1) lib/warden/manager.rb:35:in `block in call'
warden (1.1.1) lib/warden/manager.rb:34:in `catch'
warden (1.1.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__1039351831__call__833288071__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
railties (3.2.1) lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/utils.rb:479:in `safe_fork'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server.rb:180:in `start'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/helper-scripts/passenger-spawn-server:99:in `<main>'
As i can understand,
your params[:package_crew] is returning nil
check your params[:package_crew]
try following
pid,cid = 0
if params[:package_crew]
pid = params[:package_crew][:package_id]
cid = params[:package_crew][:crew_id]
end
#package = Package.find(pid)
#crew = Crew.find(cid)
i would suggest rather use this.
Package.find_by_id(pid) # this wont raise exception, when record is not found
Crew.find_by_id(cid)

Called id for nil, Active admin

im working with active admin i have collection_select or dropdown box that populates the packages and crews im just wondering i why this
undefined method `[]' for nil:NilClass`
i dont know what happened but it run few days ago and tested it once but now it raises this error are there possible way to solve this?
def create
#package = Package.find(params[:package_crew][:package_id])
crew = Crew.find(params[:package_crew][:crew_id] )
#package_crew = #package.add_crew(crew.id)
if #package_crew.save
redirect_to {admin_package_crew_url}
end
end
thanks in advance more power to us all
i tried this and
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
tried create
def create
#pid = params[:package_crew][:crew_id] if params[:package_crew]
pid,cid = 2 #tried nil,0..10
if params[:package_crew]
pid = params[:package_crew][:package_id]
cid = params[:package_crew][:crew_id]
end
#package = Package.find_by_id(pid)
crew = Crew.find_by_id(cid)
##package = Package.find(params[:package_crew][:package_id])
#crew = Crew.find(params[:package_crew][:crew_id] )
#package_crew = #package.add_crew(crew.id)
if #package_crew.save
redirect_to {admin_package_crew_url}
end
end
add_crew method
def add_crew(crew_id)
current_package = package_crews.find_by_crew_id(crew_id)
if current_package
current_package.quantity = current_package.quantity.to_i + 1
else
current_package = package_crews.build(:crew_id => crew_id)
current_package.price = current_package.crew.price
end
current_package
end
moving parameters
{"utf8"=>"✓",
"authenticity_token"=>"n4WZpQpES6mnSO12oGKV/MeoxAVvV9OmJQKfhcpnvQM=",
"crew_for_package"=>{"package_id"=>"1",
"crew_id"=>"1",
"quantity"=>"1"},
"commit"=>"Create Package crew"}
stack error
app/admin/package_crews.rb:35:in `create'
actionpack (3.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.1) lib/active_support/callbacks.rb:447:in `_run__304549499__process_action__775442107__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
activerecord (3.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.1) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `dispatch'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:30:in `call'
journey (1.0.3) lib/journey/router.rb:68:in `block in call'
journey (1.0.3) lib/journey/router.rb:56:in `each'
journey (1.0.3) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `call'
sass (3.1.15) lib/sass/plugin/rack.rb:54:in `call'
warden (1.1.1) lib/warden/manager.rb:35:in `block in call'
warden (1.1.1) lib/warden/manager.rb:34:in `catch'
warden (1.1.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__1039351831__call__833288071__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
railties (3.2.1) lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/utils.rb:479:in `safe_fork'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server.rb:180:in `start'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/led/.passenger/standalone/3.0.11-x86-ruby1.9.3-linux-gcc4.6.3-1002/support/helper-scripts/passenger-spawn-server:99:in `<main>'
What you send :
{
"crew_for_package" => {
"package_id"=>"1",
"crew_id"=>"1",
"quantity"=>"1"
}
}
What you call :
params[:package_crew][:package_id]
params[:package_crew][:crew_id]
You see something wrong? This might not fix your problem, but it should at least send you in the right direction! :-)

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