I have composite_primary_keys gem install and used with Rails 4.2.0.rc2, and I keep getting a
undefined method `ensure_initialized' for #<ActiveRecord::AttributeSet:0x007fcb319ed988>
error from this line:
Array(self.class.primary_key).each {|key| #attributes.ensure_initialized(key)}
Stack:
/Users/mmahalwy/.rvm/gems/ruby-2.1.2/bundler/gems/composite_primary_keys-0a8061943732/lib/composite_primary_keys/core.rb:6:in `block in init_internals'
/Users/mmahalwy/.rvm/gems/ruby-2.1.2/bundler/gems/composite_primary_keys-0a8061943732/lib/composite_primary_keys/core.rb:6:in `each'
/Users/mmahalwy/.rvm/gems/ruby-2.1.2/bundler/gems/composite_primary_keys-0a8061943732/lib/composite_primary_keys/core.rb:6:in `init_internals'
activerecord (4.2.0.rc2) lib/active_record/core.rb:274:in `initialize'
activerecord (4.2.0.rc2) lib/active_record/inheritance.rb:61:in `new'
activerecord (4.2.0.rc2) lib/active_record/inheritance.rb:61:in `new'
delayed_job (4.0.2) lib/delayed/backend/base.rb:29:in `enqueue'
activejob (4.2.0.rc2) lib/active_job/queue_adapters/delayed_job_adapter.rb:18:in `enqueue'
activejob (4.2.0.rc2) lib/active_job/enqueuing.rb:71:in `block in enqueue'
activesupport (4.2.0.rc2) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0.rc2) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0.rc2) lib/active_support/callbacks.rb:190:in `block in simple'
activesupport (4.2.0.rc2) lib/active_support/callbacks.rb:338:in `call'
activesupport (4.2.0.rc2) lib/active_support/callbacks.rb:338:in `block (2 levels) in simple'
activejob (4.2.0.rc2) lib/active_job/logging.rb:14:in `call'
This is caused by a bug in the version you are using for the gem. update the gem:
bundle update composite_primary_keys
and try again.
Related
Following an upgrade from Rails 5.0 to 5.1 I'm getting this error anytime the app reloads, either from code changes during rails server or if I call reload! from the console.
🌶 13:53$ rc
Loading development environment (Rails 5.1.1)
2.3.1 :001 > reload!
Reloading...
ArgumentError: unknown firstpos: NilClass
from (irb):1
2.3.1 :002 >
https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/journey/gtg/builder.rb
Application Trace is empty, here's the Framework Trace:
actionpack (5.1.1) lib/action_dispatch/journey/gtg/builder.rb:99:in `firstpos'
actionpack (5.1.1) lib/action_dispatch/journey/gtg/builder.rb:22:in `transition_table'
actionpack (5.1.1) lib/action_dispatch/journey/routes.rb:58:in `simulator'
actionpack (5.1.1) lib/action_dispatch/journey/router.rb:92:in `simulator'
actionpack (5.1.1) lib/action_dispatch/journey/router.rb:28:in `eager_load!'
actionpack (5.1.1) lib/action_dispatch/routing/route_set.rb:382:in `eager_load!'
railties (5.1.1) lib/rails/application/routes_reloader.rb:26:in `each'
railties (5.1.1) lib/rails/application/routes_reloader.rb:26:in `execute'
railties (5.1.1) lib/rails/application/finisher.rb:141:in `block (2 levels) in <module:Finisher>'
activesupport (5.1.1) lib/active_support/callbacks.rb:413:in `instance_exec'
activesupport (5.1.1) lib/active_support/callbacks.rb:413:in `block in make_lambda'
activesupport (5.1.1) lib/active_support/callbacks.rb:197:in `block (2 levels) in halting'
activesupport (5.1.1) lib/active_support/callbacks.rb:601:in `block (2 levels) in default_terminator'
activesupport (5.1.1) lib/active_support/callbacks.rb:600:in `catch'
activesupport (5.1.1) lib/active_support/callbacks.rb:600:in `block in default_terminator'
activesupport (5.1.1) lib/active_support/callbacks.rb:198:in `block in halting'
activesupport (5.1.1) lib/active_support/callbacks.rb:507:in `block in invoke_before'
activesupport (5.1.1) lib/active_support/callbacks.rb:507:in `each'
activesupport (5.1.1) lib/active_support/callbacks.rb:507:in `invoke_before'
activesupport (5.1.1) lib/active_support/callbacks.rb:130:in `run_callbacks'
activesupport (5.1.1) lib/active_support/execution_wrapper.rb:108:in `run!'
activesupport (5.1.1) lib/active_support/reloader.rb:113:in `run!'
activesupport (5.1.1) lib/active_support/execution_wrapper.rb:70:in `block in run!'
activesupport (5.1.1) lib/active_support/execution_wrapper.rb:67:in `tap'
activesupport (5.1.1) lib/active_support/execution_wrapper.rb:67:in `run!'
activesupport (5.1.1) lib/active_support/reloader.rb:59:in `run!'
actionpack (5.1.1) lib/action_dispatch/middleware/executor.rb:10:in `call'
actionpack (5.1.1) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
actionpack (5.1.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.1) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.1) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
request_store (1.3.2) lib/request_store/middleware.rb:9:in `call'
actionpack (5.1.1) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.3) lib/rack/method_override.rb:22:in `call'
rack (2.0.3) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.1) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.1) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.3) lib/rack/sendfile.rb:111:in `call'
railties (5.1.1) lib/rails/engine.rb:522:in `call'
puma (3.9.1) lib/puma/configuration.rb:224:in `call'
puma (3.9.1) lib/puma/server.rb:602:in `handle_request'
puma (3.9.1) lib/puma/server.rb:435:in `process_client'
puma (3.9.1) lib/puma/server.rb:299:in `block in run'
puma (3.9.1) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
I just faced exactly the same problem. I sovled it by setting:
config/environments/development.rb
from:
# Do not eager load code on boot.
config.eager_load = true
to:
**# Do not eager load code on boot.
config.eager_load = false
Hope this helps!
Cheers, Nic.
Workaround found! https://github.com/rails/rails/pull/32296
The pull request is not merged, and will probably only be in 5.2+ anyway. Adding a monkey patch with the one-line change fixed the problem entirely for me.
config/initializers/routes.rb
# MONKEY PATCH!!!
# https://github.com/rails/rails/pull/32296
#
# Fixes:
# * Development mode deadlocks
# * ArgumentError: unknown firstpos: NilClass
#
# Allows use of "config.eager_load = true"
module ActionDispatch
module Journey
class Routes
def simulator
#simulator ||= begin
gtg = GTG::Builder.new(ast).transition_table unless ast.blank?
GTG::Simulator.new(gtg)
end
end
end
end
end
Seems it is Spring hanging or something. Just run spring stop and it should go away. Alternatively you can start the rails console without spring like this:
DISABLE_SPRING=true rails c.
I started having this problem after upgrading Rails from 5.1 to 5.2
It got solved by:
spring stop
spring binstub --all
spring start
rails s
You will not get this bug in production environment and in a test environment (if you don't use Spring).
Because this bug "ArgumentError: unknown firstpos: NilClass" you got in "reload" when it tried to reload some your classes.
In production and test environments all things are in cache, so all your things will be cached and bug will not happen
Unfortunately (for now) for the development environment, I also found only this solution
config.eager_load = false
Hey guys i recently updated my mac to latest OS X 10.12.3
Previously my rails project was working fine, now whenever i start my rails server i keep getting this error for my project. I've tried a lot of different solution provided here in stackoverflow it simply still not working.
Here are some of it i've tried
Postgres could not connect to server
PostgreSQL error 'Could not connect to server: No such file or directory'
Thanks, please help me
PG::ConnectionBad (could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
):
activerecord (5.0.0.1) lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `initialize'
activerecord (5.0.0.1) lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `new'
activerecord (5.0.0.1) lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `connect'
activerecord (5.0.0.1) lib/active_record/connection_adapters/postgresql_adapter.rb:217:in `initialize'
activerecord (5.0.0.1) lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `new'
activerecord (5.0.0.1) lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:721:in `new_connection'
activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:765:in `checkout_new_connection'
activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:744:in `try_to_checkout_new_connection'
activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:705:in `acquire_connection'
activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:501:in `checkout'
activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:364:in `connection'
activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:875:in `retrieve_connection'
activerecord (5.0.0.1) lib/active_record/connection_handling.rb:128:in `retrieve_connection'
activerecord (5.0.0.1) lib/active_record/connection_handling.rb:91:in `connection'
activerecord (5.0.0.1) lib/active_record/migration.rb:558:in `connection'
activerecord (5.0.0.1) lib/active_record/migration.rb:545:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.3.1) lib/web_console/middleware.rb:131:in `call_app'
web-console (3.3.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.3.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.3.1) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
rack (2.0.1) lib/rack/handler/webrick.rb:86:in `service'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
Rendering /Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (5.0ms)
Rendering /Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.2ms)
Rendering /Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.7ms)
Rendered /Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (98.5ms)
[2017-02-01 15:42:00] ERROR PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `initialize'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `new'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `connect'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:217:in `initialize'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `new'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:721:in `new_connection'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:765:in `checkout_new_connection'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:744:in `try_to_checkout_new_connection'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:705:in `acquire_connection'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:501:in `checkout'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:364:in `connection'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:875:in `retrieve_connection'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_handling.rb:128:in `retrieve_connection'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_handling.rb:91:in `connection'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/query_cache.rb:47:in `block in install_executor_hooks'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:396:in `instance_exec'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:396:in `block in make_lambda'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:169:in `block (2 levels) in halting'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:547:in `block (2 levels) in default_terminator'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:546:in `catch'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:546:in `block in default_terminator'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:170:in `block in halting'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:454:in `block in call'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:454:in `each'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:454:in `call'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_complete_callbacks'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0.1/lib/active_support/execution_wrapper.rb:107:in `complete!'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/executor.rb:13:in `block in call'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/body_proxy.rb:23:in `close'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/handler/webrick.rb:115:in `service'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/Users/leo/.rbenv/versions/2.3.2/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
Try starting your postgres server using this command:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
i found solution for this. Just download the postgres app
http://postgresapp.com/
Not sure if it will work for everyone, but it worked for me :)
I created Rails application with sqlite database. After some time I decided to switch to postgresql in development environment also. I use postgresql in production (Heroku).
I have 59 Rspec tests and they all pass when using sqlite. But after migration to postgresql some of them start failing. I noticed that in some examples FactoryGirl didn't create objects, so application display error when going to for example /words/1 url that it couldn't find Word with such ID.
The only way I was able to make tests pass again was changing database_cleaner configuration.
From:
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
To:
config.before(:each) do
DatabaseCleaner.strategy = :truncation
end
Another tricky way to pass all tests was making all of them js: true.
Do you have any ideas how to fix this issue? What's the correct solution here?
Errors after running tests:
Failures:
1) User adds comment when signed in and try to add empty comment
Failure/Error: fill_in 'Treść komentarza:', with: ''
Capybara::ElementNotFound:
Unable to find field "Treść komentarza:"
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:44:in `block in find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/base.rb:85:in `synchronize'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:33:in `find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/actions.rb:59:in `fill_in'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/session.rb:699:in `block (2 levels) in <class:Session>'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
# ./spec/features/user_adds_comment_spec.rb:25:in `block (2 levels) in <top (required)>'
2) User adds comment when signed out
Failure/Error: expect(page).to have_content 'Zaloguj się, aby dodać komentarz'
expected to find text "Zaloguj się, aby dodać komentarz" in "ActiveRecord::RecordNotFound at /words/1 ======================================== > Couldn't find Word with 'id'=1 app/views/words/show.html.haml, line 1 -------------------------------------- ``` ruby > 1 - title \"\#{word.pl} po angielsku to \#{word.en}\" 2 .row 3 .col-md-12 4 %h1= word.en 5 .col-md-4 6 %p ``` App backtrace ------------- - app/views/words/show.html.haml:1:in `_app_views_words_show_html_haml__1962247352459501123_87235100' - spec/features/user_adds_comment_spec.rb:33:in `block (2 levels) in ' Full backtrace -------------- - activerecord (4.2.6) lib/active_record/relation/finder_methods.rb:324:in `raise_record_not_found_exception!' - activerecord (4.2.6) lib/active_record/relation/finder_methods.rb:444:in `find_one' - activerecord (4.2.6) lib/active_record/relation/finder_methods.rb:423:in `find_with_ids' - activerecord (4.2.6) lib/active_record/relation/finder_methods.rb:71:in `find' - decent_exposure (2.3.3) lib/decent_exposure/active_record_strategy.rb:60:in `singular_resource' - decent_exposure (2.3.3) lib/decent_exposure/active_record_strategy.rb:70:in `resource' - decent_exposure (2.3.3) lib/decent_exposure/strategies/assign_from_method.rb:14:in `resource' - decent_exposure (2.3.3) lib/decent_exposure/exposure.rb:14:in `call' - decent_exposure (2.3.3) lib/decent_exposure/expose.rb:53:in `block in define_exposure_methods' - actionpack (4.2.6) lib/abstract_controller/helpers.rb:67:in `word' - app/views/words/show.html.haml:1:in `_app_views_words_show_html_haml__1962247352459501123_87235100' - actionview (4.2.6) lib/action_view/template.rb:145:in `block in render' - activesupport (4.2.6) lib/active_support/notifications.rb:166:in `instrument' - actionview (4.2.6) lib/action_view/template.rb:333:in `instrument' - actionview (4.2.6) lib/action_view/template.rb:143:in `render' - actionview (4.2.6) lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template' - actionview (4.2.6) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument' - activesupport (4.2.6) lib/active_support/notifications.rb:164:in `block in instrument' - activesupport (4.2.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument' - activesupport (4.2.6) lib/active_support/notifications.rb:164:in `instrument' - actionview (4.2.6) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument' - actionview (4.2.6) lib/action_view/renderer/template_renderer.rb:53:in `block in render_template' - actionview (4.2.6) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout' - actionview (4.2.6) lib/action_view/renderer/template_renderer.rb:52:in `render_template' - actionview (4.2.6) lib/action_view/renderer/template_renderer.rb:14:in `render' - actionview (4.2.6) lib/action_view/renderer/renderer.rb:46:in `render_template' - actionview (4.2.6) lib/action_view/renderer/renderer.rb:27:in `render' - actionview (4.2.6) lib/action_view/rendering.rb:100:in `_render_template' - actionpack (4.2.6) lib/action_controller/metal/streaming.rb:217:in `_render_template' - actionview (4.2.6) lib/action_view/rendering.rb:83:in `render_to_body' - actionpack (4.2.6) lib/action_controller/metal/rendering.rb:32:in `render_to_body' - actionpack (4.2.6) lib/action_controller/metal/renderers.rb:37:in `render_to_body' - actionpack (4.2.6) lib/abstract_controller/rendering.rb:25:in `render' - actionpack (4.2.6) lib/action_controller/metal/rendering.rb:16:in `render' - actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render' - activesupport (4.2.6) lib/active_support/core_ext/benchmark.rb:12:in `block in ms' - /home/hubert/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/benchmark.rb:308:in `realtime' - activesupport (4.2.6) lib/active_support/core_ext/benchmark.rb:12:in `ms' - actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:44:in `block in render' - actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime' - activerecord (4.2.6) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime' - actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:43:in `render' - remotipart (1.2.1) lib/remotipart/render_overrides.rb:14:in `render_with_remotipart' - actionpack (4.2.6) lib/action_controller/metal/implicit_render.rb:10:in `default_render' - actionpack (4.2.6) lib/action_controller/metal/implicit_render.rb:4:in `send_action' - actionpack (4.2.6) lib/abstract_controller/base.rb:198:in `process_action' - actionpack (4.2.6) lib/action_controller/metal/rendering.rb:10:in `process_action' - actionpack (4.2.6) lib/abstract_controller/callbacks.rb:20:in `block in process_action' - activesupport (4.2.6) lib/active_support/callbacks.rb:117:in `call' - activesupport (4.2.6) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile' - activesupport (4.2.6) lib/active_support/callbacks.rb:505:in `call' - activesupport (4.2.6) lib/active_support/callbacks.rb:92:in `__run_callbacks__' - activesupport (4.2.6) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks' - activesupport (4.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks' - actionpack (4.2.6) lib/abstract_controller/callbacks.rb:19:in `process_action' - actionpack (4.2.6) lib/action_controller/metal/rescue.rb:29:in `process_action' - actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' - activesupport (4.2.6) lib/active_support/notifications.rb:164:in `block in instrument' - activesupport (4.2.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument' - activesupport (4.2.6) lib/active_support/notifications.rb:164:in `instrument' - actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:30:in `process_action' - actionpack (4.2.6) lib/action_controller/metal/params_wrapper.rb:250:in `process_action' - activerecord (4.2.6) lib/active_record/railties/controller_runtime.rb:18:in `process_action' - actionpack (4.2.6) lib/abstract_controller/base.rb:137:in `process' - actionview (4.2.6) lib/action_view/rendering.rb:30:in `process' - actionpack (4.2.6) lib/action_controller/metal.rb:196:in `dispatch' - actionpack (4.2.6) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' - actionpack (4.2.6) lib/action_controller/metal.rb:237:in `block in action' - actionpack (4.2.6) lib/action_dispatch/routing/route_set.rb:74:in `dispatch' - actionpack (4.2.6) lib/action_dispatch/routing/route_set.rb:43:in `serve' - actionpack (4.2.6) lib/action_dispatch/journey/router.rb:43:in `block in serve' - actionpack (4.2.6) lib/action_dispatch/journey/router.rb:30:in `serve' - actionpack (4.2.6) lib/action_dispatch/routing/route_set.rb:817:in `call' - rack-pjax (0.8.0) lib/rack/pjax.rb:12:in `call' - warden (1.2.6) lib/warden/manager.rb:35:in `block in call' - warden (1.2.6) lib/warden/manager.rb:34:in `call' - rack (1.6.4) lib/rack/etag.rb:24:in `call' - rack (1.6.4) lib/rack/conditionalget.rb:25:in `call' - rack (1.6.4) lib/rack/head.rb:13:in `call' - remotipart (1.2.1) lib/remotipart/middleware.rb:27:in `call' - actionpack (4.2.6) lib/action_dispatch/middleware/params_parser.rb:27:in `call' - actionpack (4.2.6) lib/action_dispatch/middleware/flash.rb:260:in `call' - rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context' - rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call' - actionpack (4.2.6) lib/action_dispatch/middleware/cookies.rb:560:in `call' - activerecord (4.2.6) lib/active_record/query_cache.rb:36:in `call' - activerecord (4.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call' - actionpack (4.2.6) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' - activesupport (4.2.6) lib/active_support/callbacks.rb:88:in `__run_callbacks__' - activesupport (4.2.6) lib/active_support/callbacks.rb:778:in `_run_call_callbacks' - activesupport (4.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks' - actionpack (4.2.6) lib/action_dispatch/middleware/callbacks.rb:27:in `call' - actionpack (4.2.6) lib/action_dispatch/middleware/remote_ip.rb:78:in `call' - better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call' - better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call' - better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call' - actionpack (4.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' - web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call' - web-console (2.3.0) lib/web_console/middleware.rb:18:in `call' - actionpack (4.2.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' - railties (4.2.6) lib/rails/rack/logger.rb:38:in `call_app' - railties (4.2.6) lib/rails/rack/logger.rb:20:in `block in call' - activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `block in tagged' - activesupport (4.2.6) lib/active_support/tagged_logging.rb:26:in `tagged' - activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `tagged' - railties (4.2.6) lib/rails/rack/logger.rb:20:in `call' - request_store (1.3.1) lib/request_store/middleware.rb:9:in `call' - actionpack (4.2.6) lib/action_dispatch/middleware/request_id.rb:21:in `call' - rack (1.6.4) lib/rack/methodoverride.rb:22:in `call' - rack (1.6.4) lib/rack/runtime.rb:18:in `call' - activesupport (4.2.6) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' - rack (1.6.4) lib/rack/lock.rb:17:in `call' - actionpack (4.2.6) lib/action_dispatch/middleware/static.rb:120:in `call' - rack (1.6.4) lib/rack/sendfile.rb:113:in `call' - railties (4.2.6) lib/rails/engine.rb:518:in `call' - railties (4.2.6) lib/rails/application.rb:165:in `call' - rack (1.6.4) lib/rack/urlmap.rb:66:in `block in call' - rack (1.6.4) lib/rack/urlmap.rb:50:in `call' - rack-test (0.6.3) lib/rack/mock_session.rb:30:in `request' - rack-test (0.6.3) lib/rack/test.rb:244:in `process_request' - rack-test (0.6.3) lib/rack/test.rb:58:in `get' - /home/hubert/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/forwardable.rb:184:in `get' - capybara (2.7.1) lib/capybara/rack_test/browser.rb:61:in `process' - capybara (2.7.1) lib/capybara/rack_test/browser.rb:36:in `process_and_follow_redirects' - capybara (2.7.1) lib/capybara/rack_test/browser.rb:22:in `visit' - capybara (2.7.1) lib/capybara/rack_test/driver.rb:43:in `visit' - capybara (2.7.1) lib/capybara/session.rb:233:in `visit' - capybara (2.7.1) lib/capybara/dsl.rb:52:in `block (2 levels) in ' - rspec-rails (3.5.0) lib/rspec/rails/example/feature_example_group.rb:29:in `visit' - spec/features/user_adds_comment_spec.rb:33:in `block (2 levels) in ' - rspec-core (3.5.0) lib/rspec/core/example.rb:252:in `block in run' - rspec-core (3.5.0) lib/rspec/core/example.rb:494:in `block in with_around_and_singleton_context_hooks' - rspec-core (3.5.0) lib/rspec/core/example.rb:451:in `block in with_around_example_hooks' - rspec-core (3.5.0) lib/rspec/core/hooks.rb:471:in `block in run' - rspec-core (3.5.0) lib/rspec/core/hooks.rb:611:in `block in run_around_example_hooks_for' - rspec-core (3.5.0) lib/rspec/core/example.rb:336:in `call' - rspec-rails (3.5.0) lib/rspec/rails/adapters.rb:127:in `block (2 levels) in ' - rspec-core (3.5.0) lib/rspec/core/example.rb:441:in `instance_exec' - rspec-core (3.5.0) lib/rspec/core/hooks.rb:382:in `execute_with' - rspec-core (3.5.0) lib/rspec/core/hooks.rb:613:in `block (2 levels) in run_around_example_hooks_for' - rspec-core (3.5.0) lib/rspec/core/example.rb:336:in `call' - rspec-core (3.5.0) lib/rspec/core/hooks.rb:614:in `run_around_example_hooks_for' - rspec-core (3.5.0) lib/rspec/core/hooks.rb:471:in `run' - rspec-core (3.5.0) lib/rspec/core/example.rb:451:in `with_around_example_hooks' - rspec-core (3.5.0) lib/rspec/core/example.rb:494:in `with_around_and_singleton_context_hooks' - rspec-core (3.5.0) lib/rspec/core/example.rb:249:in `run' - rspec-core (3.5.0) lib/rspec/core/example_group.rb:613:in `block in run_examples' - rspec-core (3.5.0) lib/rspec/core/example_group.rb:609:in `run_examples' - rspec-core (3.5.0) lib/rspec/core/example_group.rb:575:in `run' - rspec-core (3.5.0) lib/rspec/core/runner.rb:113:in `block (3 levels) in run_specs' - rspec-core (3.5.0) lib/rspec/core/runner.rb:113:in `block (2 levels) in run_specs' - rspec-core (3.5.0) lib/rspec/core/configuration.rb:1837:in `with_suite_hooks' - rspec-core (3.5.0) lib/rspec/core/runner.rb:112:in `block in run_specs' - rspec-core (3.5.0) lib/rspec/core/reporter.rb:77:in `report' - rspec-core (3.5.0) lib/rspec/core/runner.rb:111:in `run_specs' - rspec-core (3.5.0) lib/rspec/core/runner.rb:87:in `run' - rspec-core (3.5.0) lib/rspec/core/runner.rb:71:in `run' - rspec-core (3.5.0) lib/rspec/core/runner.rb:45:in `invoke' - rspec-core (3.5.0) exe/rspec:4:in `' - () home/hubert/.rvm/gems/ruby-2.3.0/bin/rspec:23:in `' - () home/hubert/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `'"
# ./spec/features/user_adds_comment_spec.rb:35:in `block (2 levels) in <top (required)>'
3) User create word with missing en value
Failure/Error: find(:css, ".check_boxes[value='1']").set(true)
Capybara::ElementNotFound:
Unable to find css ".check_boxes[value='1']"
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:44:in `block in find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/base.rb:85:in `synchronize'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:33:in `find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/session.rb:699:in `block (2 levels) in <class:Session>'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
# ./spec/features/user_creates_word_spec.rb:26:in `block (2 levels) in <top (required)>'
4) User create word with missing pl value
Failure/Error: find(:css, ".check_boxes[value='1']").set(true)
Capybara::ElementNotFound:
Unable to find css ".check_boxes[value='1']"
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:44:in `block in find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/base.rb:85:in `synchronize'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:33:in `find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/session.rb:699:in `block (2 levels) in <class:Session>'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
# ./spec/features/user_creates_word_spec.rb:33:in `block (2 levels) in <top (required)>'
5) User create word try add the same word twice
Failure/Error: find(:css, ".check_boxes[value='1']").set(true)
Capybara::ElementNotFound:
Unable to find css ".check_boxes[value='1']"
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:44:in `block in find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/base.rb:85:in `synchronize'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:33:in `find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/session.rb:699:in `block (2 levels) in <class:Session>'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
# ./spec/features/user_creates_word_spec.rb:48:in `block (2 levels) in <top (required)>'
6) User create word strip word if add unnecessary spaces
Failure/Error: find(:css, ".check_boxes[value='1']").set(true)
Capybara::ElementNotFound:
Unable to find css ".check_boxes[value='1']"
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:44:in `block in find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/base.rb:85:in `synchronize'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:33:in `find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/session.rb:699:in `block (2 levels) in <class:Session>'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
# ./spec/features/user_creates_word_spec.rb:64:in `block (2 levels) in <top (required)>'
7) User does not see import option when signed in and he is admin
Failure/Error: User.find(1).update(admin: true)
ActiveRecord::RecordNotFound:
Couldn't find User with 'id'=1
# ./spec/features/user_does_not_see_import_option_spec.rb:19:in `block (2 levels) in <top (required)>'
8) User can only edit his words that belongs to him
Failure/Error: find(:css, ".check_boxes[value='1']").set(true)
Capybara::ElementNotFound:
Unable to find css ".check_boxes[value='1']"
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:44:in `block in find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/base.rb:85:in `synchronize'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/node/finders.rb:33:in `find'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/session.rb:699:in `block (2 levels) in <class:Session>'
# /home/hubert/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
# ./spec/features/user_edits_word_spec.rb:17:in `block (2 levels) in <top (required)>'
My solution for this is code below. I'm using only :truncation for feature tests. I hope it will help someone. Probably answer for why it works like that is here: https://github.com/DatabaseCleaner/database_cleaner#rspec-with-capybara-example
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, type: :feature) do
DatabaseCleaner.strategy = :truncation
end
I works on a Rails project, using Rails 4.2.0, gemfile:
gem 'rails', '4.2.0'
# other gems.........
we have these two models:
class shop < ActiveRecord::Base
has_many :shop_categories
end
class ShopCategory < ActiveRecord::Base
# has a column named "shop_id"
belongs_to :shop
def self.some_max(shop)
# line number: 33
where(shop: shop).maximum(:some_value)
end
end
and we have a generator, which will call the "some_max" method on ShopCategory:
# simplified, but just like this
shop = Shop.first
# lib/generators/shop/build/build_generator.rb:36
ShopCategory.some_max shop
and the generator is invoked by code inside our Rails application:
# app/services/shop_service.rb:8
Rails::Generators.invoke 'shop:build', [..params..]
and we get this error:
NoMethodError (undefined method `convert_value_to_association_ids' for ActiveRecord::PredicateBuilder:Class):
composite_primary_keys (8.1.3) lib/composite_primary_keys/relation/predicate_builder.rb:24:in `expand'
activerecord (4.2.0) lib/active_record/relation/predicate_builder.rb:43:in `block in build_from_hash'
activerecord (4.2.0) lib/active_record/relation/predicate_builder.rb:21:in `each'
activerecord (4.2.0) lib/active_record/relation/predicate_builder.rb:21:in `build_from_hash'
activerecord (4.2.0) lib/active_record/relation/query_methods.rb:958:in `build_where'
activerecord (4.2.0) lib/active_record/relation/query_methods.rb:584:in `where!'
activerecord (4.2.0) lib/active_record/relation/query_methods.rb:574:in `where'
activerecord (4.2.0) lib/active_record/querying.rb:10:in `where'
app/models/shop_category.rb:33:in `block in <class:ShopCategory>'
activerecord (4.2.0) lib/active_record/scoping/named.rb:155:in `call'
activerecord (4.2.0) lib/active_record/scoping/named.rb:155:in `block (2 levels) in scope'
activerecord (4.2.0) lib/active_record/relation.rb:302:in `scoping'
activerecord (4.2.0) lib/active_record/scoping/named.rb:155:in `block in scope'
app/models/shop_category.rb:28:in `block in <class:ShopCategory>'
activesupport (4.2.0) lib/active_support/callbacks.rb:443:in `instance_exec'
activesupport (4.2.0) lib/active_support/callbacks.rb:443:in `block in make_lambda'
activesupport (4.2.0) lib/active_support/callbacks.rb:163:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:163:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:92:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:92:in `_run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in `_run_create_callbacks'
activerecord (4.2.0) lib/active_record/callbacks.rb:306:in `_create_record'
activerecord (4.2.0) lib/active_record/timestamp.rb:57:in `_create_record'
activerecord (4.2.0) lib/active_record/persistence.rb:501:in `create_or_update'
activerecord (4.2.0) lib/active_record/callbacks.rb:302:in `block in create_or_update'
activesupport (4.2.0) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:219:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:92:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:92:in `_run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in `_run_save_callbacks'
activerecord (4.2.0) lib/active_record/callbacks.rb:302:in `create_or_update'
activerecord (4.2.0) lib/active_record/persistence.rb:120:in `save'
activerecord (4.2.0) lib/active_record/validations.rb:37:in `save'
activerecord (4.2.0) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (4.2.0) lib/active_record/transactions.rb:286:in `block (2 levels) in save'
activerecord (4.2.0) lib/active_record/transactions.rb:347:in `block in with_transaction_returning_status'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
activerecord (4.2.0) lib/active_record/transactions.rb:220:in `transaction'
activerecord (4.2.0) lib/active_record/transactions.rb:344:in `with_transaction_returning_status'
activerecord (4.2.0) lib/active_record/transactions.rb:286:in `block in save'
activerecord (4.2.0) lib/active_record/transactions.rb:301:in `rollback_active_record_state!'
activerecord (4.2.0) lib/active_record/transactions.rb:285:in `save'
activerecord (4.2.0) lib/active_record/associations/singular_association.rb:79:in `_create_record'
activerecord (4.2.0) lib/active_record/associations/singular_association.rb:21:in `create'
activerecord (4.2.0) lib/active_record/associations/builder/singular_association.rb:22:in `create_shop_category'
lib/generators/shop/build/build_generator.rb:36:in `create_shop_category'
lib/generators/shop/build/build_generator.rb:30:in `copy_shop_files'
thor (0.19.1) lib/thor/command.rb:27:in `run'
thor (0.19.1) lib/thor/invocation.rb:126:in `invoke_command'
thor (0.19.1) lib/thor/invocation.rb:133:in `block in invoke_all'
thor (0.19.1) lib/thor/invocation.rb:133:in `each'
thor (0.19.1) lib/thor/invocation.rb:133:in `map'
thor (0.19.1) lib/thor/invocation.rb:133:in `invoke_all'
thor (0.19.1) lib/thor/group.rb:232:in `dispatch'
thor (0.19.1) lib/thor/base.rb:440:in `start'
railties (4.2.0) lib/rails/generators.rb:157:in `invoke'
app/services/shop_service.rb:8:in `build'
app/controllers/after_registers_controller.rb:180:in `go_shop_step'
app/controllers/after_registers_controller.rb:107:in `go_retail_steps'
app/controllers/after_registers_controller.rb:46:in `update'
actionpack (4.2.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.0) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.0) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.0) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:151:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:151:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:151:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:234:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:234:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:234:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:234:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:92:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:92:in `_run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in `_run_process_action_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.0) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.2.0) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.0) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.0) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.0) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.2.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.0) lib/action_controller/metal.rb:236:in `block in action'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:42:in `serve'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:802:in `call'
rack-raw-upload (1.1.1) lib/rack/raw_upload.rb:18:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:38:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
remotipart (1.2.1) lib/remotipart/middleware.rb:27:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:647:in `call'
activerecord (4.2.0) lib/active_record/migration.rb:378:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:in `_run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in `_run_call_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.3.0) lib/web_console/middleware.rb:20:in `block in call'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in `call'
rack-cors (0.4.0) lib/rack/cors.rb:80:in `call'
railties (4.2.0) lib/rails/engine.rb:518:in `call'
railties (4.2.0) lib/rails/application.rb:164:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
thin (1.6.4) lib/thin/connection.rb:86:in `block in pre_process'
thin (1.6.4) lib/thin/connection.rb:84:in `catch'
thin (1.6.4) lib/thin/connection.rb:84:in `pre_process'
thin (1.6.4) lib/thin/connection.rb:53:in `process'
thin (1.6.4) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.2.0.1) lib/eventmachine.rb:194:in `run_machine'
eventmachine (1.2.0.1) lib/eventmachine.rb:194:in `run'
thin (1.6.4) lib/thin/backends/base.rb:73:in `start'
thin (1.6.4) lib/thin/server.rb:162:in `start'
rack (1.6.4) lib/rack/handler/thin.rb:19:in `run'
rack (1.6.4) lib/rack/server.rb:286:in `start'
railties (4.2.0) lib/rails/commands/server.rb:80:in `start'
railties (4.2.0) lib/rails/commands/commands_tasks.rb:80:in `block in server'
railties (4.2.0) lib/rails/commands/commands_tasks.rb:75:in `tap'
railties (4.2.0) lib/rails/commands/commands_tasks.rb:75:in `server'
railties (4.2.0) lib/rails/commands/commands_tasks.rb:39:in `run_command!'
railties (4.2.0) lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:8:in `require'
bin/rails:8:in `<top (required)>'
spring (1.7.1) lib/spring/client/rails.rb:28:in `load'
spring (1.7.1) lib/spring/client/rails.rb:28:in `call'
spring (1.7.1) lib/spring/client/command.rb:7:in `call'
spring (1.7.1) lib/spring/client.rb:30:in `run'
spring (1.7.1) bin/spring:49:in `<top (required)>'
spring (1.7.1) lib/spring/binstub.rb:11:in `load'
spring (1.7.1) lib/spring/binstub.rb:11:in `<top (required)>'
/home/robin/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/robin/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Rendered /home/robin/.rvm/gems/ruby-2.2.3/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (12.4ms)
Rendered /home/robin/.rvm/gems/ruby-2.2.3/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (4.1ms)
Rendered /home/robin/.rvm/gems/ruby-2.2.3/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.3ms)
Rendered /home/robin/.rvm/gems/ruby-2.2.3/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (32.8ms)
I understood this errore happened when Rails try convert this line:
where(shop: shop).maximum(:some_value)
to something like that:
# when I change the line above to this, the error disappeared
where(shop_id: shop.id).maximum(:some_value)
also, I checked the Rails document, and found that ActiveRecord::PredicateBuilder has a class method called "convert_value_to_association_ids" in Rails version 4.2.1, but not in 4.2.0. So why Rails call a method does't exist in current version(4.2.0)? Does this have something to do with the environment of the generator invoking? Thanks in advance.
===========================================
Update:
In my rails project, i run "bundle show activerecord", it give me a path to my activerecord gem, and follow this path, I open the file in "lib/active_record/relation/predicate_builder.rb", and I can't find the class method "convert_value_to_association_ids" in this file.
The error is actually coming from composite_primary_keys, v8.1.3, not rails/activerecord:
value = convert_value_to_association_ids(value, primary_key)
It uses this method, even though it depends on activerecord 4.2.0, in which the method does not yet exist. It's a bug in that version of the composite_primary_keys gem.
The password works well, but Rails does not work.
Application Trace | Framework Trace | Full Trace
mysql2 (0.4.3) lib/mysql2/client.rb:87:in `connect'
mysql2 (0.4.3) lib/mysql2/client.rb:87:in `initialize'
activerecord (4.2.6) lib/active_record/connection_adapters/mysql2_adapter.rb:18:in `new'
activerecord (4.2.6) lib/active_record/connection_adapters/mysql2_adapter.rb:18:in `mysql2_connection'
activerecord (4.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
activerecord (4.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
activerecord (4.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
activerecord (4.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
activerecord (4.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
activerecord (4.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
activerecord (4.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
activerecord (4.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
activerecord (4.2.6) lib/active_record/connection_handling.rb:113:in `retrieve_connection'
activerecord (4.2.6) lib/active_record/connection_handling.rb:87:in `connection'
activerecord (4.2.6) lib/active_record/migration.rb:383:in `connection'
activerecord (4.2.6) lib/active_record/migration.rb:370:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.6) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.6) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.6) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.3.0) lib/web_console/middleware.rb:20:in `block in call'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.6) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.6) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.6) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.6) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.6) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/static.rb:120:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.6) lib/rails/engine.rb:518:in `call'
railties (4.2.6) lib/rails/application.rb:165:in `call'
/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:152:in `accept_and_process_next_request'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
Does rails dbconsole give you the same error? If so, check your database.yml file. There are two possibilities:
Your username is wrong
Your password is wrong
/usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/application/configuration.rb:115:in `rescue in database_configuration': YAML syntax error occurred while parsing /usr/share/nginx/html/blog/myapp/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): did not find expected key while parsing a block mapping at line 12 column 1 (RuntimeError)
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/application/configuration.rb:98:in `database_configuration'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/dbconsole.rb:119:in `configurations'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/dbconsole.rb:99:in `config'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/dbconsole.rb:22:in `start'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/dbconsole.rb:11:in `start'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:86:in `dbconsole'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'