Carrierwave upload hits Errno::EEXIST - file exists error - carrierwave

Have installed a rails3.2.18 application on two machines: a Ubuntu 14.04 and osx 10.6 for testing purposes.
Submitting a file for upload on the OS X box (these files are intentionally big) with carrierwave returns Errno::EEXIST in [...] controller specifying:
File exists - /Users/user/app/releases/20141018152115/public/uploads
This error is not occurring on Ubuntu installation. public/uploads exists because it needs to be a symlink to shared/public/uploads for persistence requirements. The capistrano3 deploy command
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads}
sets the symlink up. For good measure I ran deploys on both machines sequentially to isolate any app issues.
So this again appears to be an OSX issue. One assumption is that the given stage file is somehow misconfigured for OSX, although the (only) user with admin rights is appropriately specified:
set :deploy_to, '/Users/osxuser/app'
set :use_sudo, false
set :deploy_user, 'osxuser'
Another assumption is related to the migration from Capistrano2 to Capistrano3, as this osX server did not have such issues prior to the upgrade.
How can the 'file exists' error be eliminated?
Update
/Users/osxuser/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/fileutils.rb:244:in `mkdir'
/Users/osxuser/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/fileutils.rb:244:in `fu_mkdir'
/Users/osxuser/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'
/Users/osxuser/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'
/Users/osxuser/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'
/Users/osxuser/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/fileutils.rb:205:in `each'
/Users/osxuser/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'
carrierwave (0.9.0) lib/carrierwave/sanitized_file.rb:290:in `mkdir!'
carrierwave (0.9.0) lib/carrierwave/sanitized_file.rb:209:in `copy_to'
carrierwave (0.9.0) lib/carrierwave/uploader/cache.rb:131:in `block in cache!'
carrierwave (0.9.0) lib/carrierwave/uploader/callbacks.rb:17:in `with_callbacks'
carrierwave (0.9.0) lib/carrierwave/uploader/cache.rb:122:in `cache!'
carrierwave (0.9.0) lib/carrierwave/mount.rb:327:in `cache'
carrierwave (0.9.0) lib/carrierwave/mount.rb:179:in `production_file='
carrierwave (0.9.0) lib/carrierwave/orm/activerecord.rb:38:in `production_file='
activerecord (3.2.18) lib/active_record/attribute_assignment.rb:85:in `block in assign_attributes'
activerecord (3.2.18) lib/active_record/attribute_assignment.rb:78:in `each'
activerecord (3.2.18) lib/active_record/attribute_assignment.rb:78:in `assign_attributes'
activerecord (3.2.18) lib/active_record/persistence.rb:216:in `block in update_attributes'
activerecord (3.2.18) lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
activerecord (3.2.18) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
activerecord (3.2.18) lib/active_record/transactions.rb:208:in `transaction'
activerecord (3.2.18) lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
activerecord (3.2.18) lib/active_record/persistence.rb:215:in `update_attributes'
app/controllers/bozzadocuments_controller.rb:62:in `block in update'
the stack trace appears to be wanting to mkdir carrierwave (0.9.0) lib/carrierwave/sanitized_file.rb:290:in mkdir!
the carrierwave uploader is specified as follows
def store_dir
"uploads/#{model.class.to_s.underscore}/#{model.quote.cart_id}_#{model.quote.cart.created_at}_/#{model.quote_id}/#{model.id}"
end

This is a pitfall when creating an OS-X 'alias' instead of a symlink.
(Not in the actual gems resp. any specific version – I experienced the same today with rails 5.0.0.1, ruby 3.2.1 and carrierwave 0.11.2.)
It turned out that I had accidently created not a symlink but an alias using the OS X Finder (which technically is not a symlink). When carrierwave then tries to create the folder structure FileUtils.mkir_p raises an error on trying to (re)create the (existing) alias as a directory.
rm ./app/releases/20141018152115/public/uploads
ln -s ./app/shared/public/uploads ./app/releases/$timestamp/public/uploads
should do the trick.
[EDIT: Clarified the actual root cause is not in ruby, rails or the gems in use]

Related

How to get PostgreSQL to work

I recently deployed a heroku app and it gave me an error that sqlite3 isn't supported so I made a new project using the rails new -d postgresql project_name command. And everything worked (it currently has a stable version that people can access on the web), until I added a scaffold: rails g scaffold Projects and then went into the routes.rb and added , :only [:index, :show] and then ran the server. Which worked until I loaded the home page, then I got the 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 "/var/run/postgresql/.s.PGSQL.5432"?
):
There are similar questions on here, but they are usually erroring on Heroku's side, while this is just being run locally.
What is causing this error?
Fun fact: /var/run/postgresql/ isn't a directory I have.
EDIT:
OS: Ubuntu on an Oracle VM
The full console response:
PG::ConnectionBad (could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
):
pg (1.0.0) lib/pg.rb:56:in `initialize'
pg (1.0.0) lib/pg.rb:56:in `new'
pg (1.0.0) lib/pg.rb:56:in `connect'
activerecord (5.1.6) lib/active_record/connection_adapters/postgresql_adapter.rb:697:in `connect'
activerecord (5.1.6) lib/active_record/connection_adapters/postgresql_adapter.rb:221:in `initialize'
activerecord (5.1.6) lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
activerecord (5.1.6) lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
activerecord (5.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
activerecord (5.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
activerecord (5.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
activerecord (5.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
activerecord (5.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
activerecord (5.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
activerecord (5.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
activerecord (5.1.6) lib/active_record/connection_handling.rb:116:in `retrieve_connection'
activerecord (5.1.6) lib/active_record/connection_handling.rb:88:in `connection'
activerecord (5.1.6) lib/active_record/migration.rb:562:in `connection'
activerecord (5.1.6) lib/active_record/migration.rb:553:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.6) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.6) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.6.2) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.6.2) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.6.2) lib/web_console/middleware.rb:20:in `catch'
web-console (3.6.2) lib/web_console/middleware.rb:20:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.6) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.6) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.6) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.5) lib/rack/method_override.rb:22:in `call'
rack (2.0.5) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.5) lib/rack/sendfile.rb:111:in `call'
railties (5.1.6) lib/rails/engine.rb:522:in `call'
puma (3.11.4) lib/puma/configuration.rb:225:in `call'
puma (3.11.4) lib/puma/server.rb:632:in `handle_request'
puma (3.11.4) lib/puma/server.rb:446:in `process_client'
puma (3.11.4) lib/puma/server.rb:306:in `block in run'
puma (3.11.4) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
The database.yml:
# PostgreSQL. Versions 9.1 and up are supported.
#
# Install the pg driver:
# gem install pg
# On OS X with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
#
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: rileyshaw_development
# The specified database role being used to connect to postgres.
# To create additional roles in postgres see `$ createuser --help`.
# When left blank, postgres will use the default role. This is
# the same name as the operating system user that initialized the database.
#username: rileyshaw
# The password associated with the postgres role (username).
#password:
# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
#host: localhost
# The TCP port the server listens on. Defaults to 5432.
# If your server runs on a different port number, change accordingly.
#port: 5432
# Schema search path. The server defaults to $user,public
#schema_search_path: myapp,sharedapp,public
# Minimum log levels, in increasing order:
# debug5, debug4, debug3, debug2, debug1,
# log, notice, warning, error, fatal, and panic
# Defaults to warning.
#min_messages: notice
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: rileyshaw_test
# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password as a unix environment variable when you boot
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full rundown on how to provide these environment variables in a
# production deployment.
#
# On Heroku and other platform providers, you may have a full connection URL
# available as an environment variable. For example:
#
# DATABASE_URL="postgres://myuser:mypass#localhost/somedatabase"
#
# You can use this database configuration with:
#
# production:
# url: <%= ENV['DATABASE_URL'] %>
#
production:
<<: *default
database: rileyshaw_production
username: rileyshaw
password: <%= ENV['RILEYSHAW_DATABASE_PASSWORD'] %>
Add this to your Gemfile
group: production do
gem "pg"
end
group: development do
gem "sqlite3"
end
Then bundle install
gem "Pg" serves for production purpose while gem "sqlite3" can still be used locally, But I highly advise that you install and get Postgres up and running on your system to avoid future breakdown. But if you're doing a fast prototyping, then go ahead
it seems you didn't install postgres and didn't add proper user.
https://gorails.com/setup/ubuntu/16.04#postgresql should be your answer :)

Rails - erratic Timeout errors possibly tied to asset compilation

Preemptive apologies for the code dump. I've been banging my head against this one for a while (and doing a ton of Googling) and just have a pretty fuzzy idea what is and isn't relevant, and how to fix things. So I figured I'd get as much info as possible out there. Please let me know if there's anything else I should add that might be helpful. Thanks!
I'm starting up a Rails and Angular app and mostly still in development mode. I'm using Heroku, but I don't know if these issues are serious there as well, cause I've mostly been coding and bumping into them on local (have barely poked around on production). (Just mentioned, because most similar questions seem to be Heroku-specific).
The error I keep intermittently bumping into is this one:
Rack::Timeout::RequestTimeoutError: Request ran for longer than 5 seconds.
and its doppelganger:
ActionView::Template::Error: Request ran for longer than 5 seconds.
When it's raised, it points to different files as the immediate culprit -- but always a Java/CoffeeScript or CSS/SASS file. Occasionally reloading the browser on the local server will pinwheel eternally instead of raising the above error. Often, a refresh will work fine, but occasionally I have to restart the server to "unfreeze" it.
I could try increasing the Rack::Timeout to something larger, but it strikes me that that would be treating one of potentially many symptoms, rather than the underlying problem.
I'm convinced this has something to do with an asset precompilation mistake of some sort -- which I'm new to, as this is my first serious app from scratch, particularly combining Angular and Rails.
I've had a hard time finding really smooth combinations of Rails and Angular -- advice is definitely appreciated.
I've managed to pinpoint the error by running and rerunning some feature specs while messing with my manifest SASS file. Every time I change the application.sass file by commenting some #imports out, (some of) the feature specs fail, but if I re-run them, they pass again and again, until I comment in or out a different line. The specific line(s) don't seem relevant, but, just in case I'm wrong, here's my application.sass file:
#charset "utf-8"
#import "bootstrap-sprockets"
#import "bootstrap"
#import "bourbon"
#import "base/grid-settings"
#import "neat"
#import "base/base"
#import "leaflet"
#import "skeleton/base"
#import "skeleton/layout"
#import "skeleton/skeleton"
#import "sections/header"
#import "sections/footer"
#import "sections/user"
#import "sections/map"
#import "sections/tabs"
#import "sections/baseapp"
#import "markercluster/MarkerCluster"
#import "markercluster/MarkerCluster.Default"
#import "icons"
#import "font-awesome-sprockets"
#import "font-awesome"
Because I think my messy asset solution is possibly to blame, I'll paste most of the relevant code below. Basically, I'm using NPM (package.json) for server-side JS stuff like Jasmine for testing, and Bower for client-side stuff like Angular and Leaflet (for maps). To make the Bower JS available in the Rails app, I'm using Rails Assets in my Gemfile. (Though I don't get why I need the bower.json stuff if I'm doing that). So the relevant parts of those manifest files look like this:
package.json
{
"name": "whatever",
"dependencies": {
"rosie": "0.2.0",
"bower": "1.2.8",
"jasmine": "2.1.1",
"phantomjs": "1.9.13",
"sinon": "1.12.2",
"jasmine-sinon": "0.4.0",
"requirejs": "2.1.15"
},
"devDependencies": {
"grunt": "~0.4.4"
}
}
bower.json
{
"name": "whatever",
"version": "0.1.0",
"authors": [
"Whatever"
],
"ignore": [
"**/.*",
"node_modules",
"bower_compnents",
"test",
"tests"
],
"dependencies": {
"angular": "latest",
"angular-resource": "latest",
"angular-route": "latest",
"angular-mocks": "latest",
"active-support": "latest",
"async": "latest",
"lodash": "latest",
"leaflet": "latest",
"leaflet.markercluster": "latest"
}
}
I mean to tie down the versions before putting this in front of users.
Gemfile
gem 'rails-assets-angular'
gem 'rails-assets-angular-resource'
gem 'rails-assets-angular-route'
gem 'rails-assets-angular-mocks'
gem 'rails-assets-active-support'
gem 'rails-assets-async'
gem 'rails-assets-lodash'
gem 'rails-assets-leaflet'
gem 'rails-assets-requirejs'
gem 'rails-assets-sinon'
# gem 'rails-assets-leaflet.markercluster' -- wasn't working, so I included the relevant scripts in app/assets/javascripts/ -- seems to be working
I've also added these in the test group of my Gemfile. I'm worried about the overlap and sprawl of these JS inclusions, but this was what got the JS tests to work.
gem "jasmine-rails"
gem 'jasmine-headless-webkit'
gem 'guard-jasmine'
gem 'rails-assets-rosie'
gem "sinon-rails"
I have a handful of assets I manually precompile for a variety of reasons:
config/initializers/assets.rb
Rails.application.config.assets.precompile += [
'api/bookmarklets/view.js',
'sections/bookmarklet.css',
'icons.eot',
'icons.svg',
'icons.ttf',
'icons.woff'
]
Locally, (and on production for now), my assets are just hosted on the server (so at localhost:3000). Doubt the DB is related, but its pool is set to 2 and timeout to 5000. Searching for other possibly related code, I found this in config/environments/development.rb -- possible problem?:
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
EDIT -- adding a full stack trace from one of the errors I hit while running the feature specs:
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sass-3.2.19/lib/sass/scss/parser.rb:125:in `[]'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sass-3.2.19/lib/sass/scss/parser.rb:125:in `process_comment'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sass-3.2.19/lib/sass/scss/parser.rb:88:in `s'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sass-3.2.19/lib/sass/scss/parser.rb:82:in `block in stylesheet'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sass-3.2.19/lib/sass/scss/parser.rb:545:in `block_contents'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sass-3.2.19/lib/sass/scss/parser.rb:82:in `stylesheet'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sass-3.2.19/lib/sass/scss/parser.rb:27:in `parse'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sass-3.2.19/lib/sass/engine.rb:342:in `_to_tree'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sass-3.2.19/lib/sass/engine.rb:315:in `_render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sass-3.2.19/lib/sass/engine.rb:262:in `render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/sass_compressor.rb:24:in `evaluate'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/context.rb:197:in `block in evaluate'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `each'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `evaluate'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/bundled_asset.rb:25:in `initialize'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `new'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/base.rb:377:in `build_asset'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/index.rb:93:in `build_asset'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/base.rb:287:in `find_asset'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/index.rb:61:in `find_asset'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-2.12.3/lib/sprockets/base.rb:295:in `[]'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-rails-2.2.2/lib/sprockets/rails/helper.rb:123:in `asset_digest_path'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-rails-2.2.2/lib/sprockets/rails/helper.rb:76:in `compute_asset_path'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/helpers/asset_url_helper.rb:132:in `asset_path'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-rails-2.2.2/lib/sprockets/rails/helper.rb:91:in `asset_path'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/helpers/asset_url_helper.rb:256:in `stylesheet_path'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/helpers/asset_tag_helper.rb:100:in `block in stylesheet_link_tag'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/helpers/asset_tag_helper.rb:96:in `map'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/helpers/asset_tag_helper.rb:96:in `stylesheet_link_tag'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/sprockets-rails-2.2.2/lib/sprockets/rails/helper.rb:170:in `stylesheet_link_tag'
# ./app/views/layouts/application.html.haml:9:in `_app_views_layouts_application_html_haml__3935206380113339538_2226830520'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/template.rb:145:in `block in render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/notifications.rb:161:in `instrument'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/template.rb:339:in `instrument'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/template.rb:143:in `render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-mini-profiler-0.9.2/lib/mini_profiler/profiling_methods.rb:79:in `block in profile_method'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/renderer/template_renderer.rb:67:in `render_with_layout'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/renderer/template_renderer.rb:53:in `render_template'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/renderer/template_renderer.rb:17:in `render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/renderer/renderer.rb:42:in `render_template'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/renderer/renderer.rb:23:in `render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/rendering.rb:99:in `_render_template'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/streaming.rb:217:in `_render_template'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/rendering.rb:82:in `render_to_body'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/rendering.rb:32:in `render_to_body'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/renderers.rb:32:in `render_to_body'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/abstract_controller/rendering.rb:25:in `render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/rendering.rb:16:in `render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/core_ext/benchmark.rb:12:in `ms'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/instrumentation.rb:41:in `block in render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.4/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/instrumentation.rb:40:in `render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/responder.rb:238:in `default_render'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/responder.rb:165:in `to_html'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/responder.rb:158:in `respond'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/responder.rb:151:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/mime_responds.rb:400:in `respond_with'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/app/controllers/devise/sessions_controller.rb:11:in `new'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/abstract_controller/base.rb:189:in `process_action'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/rendering.rb:10:in `process_action'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:113:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:113:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:229:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:229:in `block in halting'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:166:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:166:in `block in halting'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:166:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:166:in `block in halting'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:166:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:166:in `block in halting'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:149:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:149:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:149:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:149:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:86:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:86:in `run_callbacks'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/abstract_controller/callbacks.rb:19:in `process_action'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/rescue.rb:29:in `process_action'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/notifications.rb:159:in `block in instrument'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/notifications.rb:159:in `instrument'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.4/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/abstract_controller/base.rb:136:in `process'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionview-4.1.4/lib/action_view/rendering.rb:30:in `process'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-mini-profiler-0.9.2/lib/mini_profiler/profiling_methods.rb:79:in `block in profile_method'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal.rb:196:in `dispatch'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_controller/metal.rb:232:in `block in action'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:82:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:50:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/mapper.rb:45:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/journey/router.rb:71:in `block in call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/journey/router.rb:59:in `each'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/journey/router.rb:59:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:678:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/etag.rb:23:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/conditionalget.rb:25:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/middleware/flash.rb:254:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225:in `context'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/middleware/cookies.rb:560:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.4/lib/active_record/query_cache.rb:36:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/callbacks.rb:82:in `run_callbacks'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/airbrake-4.1.0/lib/airbrake/rails/middleware.rb:13:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/rack/logger.rb:38:in `call_app'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/rack/logger.rb:20:in `block in call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/tagged_logging.rb:68:in `block in tagged'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/tagged_logging.rb:26:in `tagged'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/tagged_logging.rb:68:in `tagged'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/rack/logger.rb:20:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/request_store-1.1.0/lib/request_store/middleware.rb:8:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/middleware/request_id.rb:21:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/middleware/static.rb:64:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/airbrake-4.1.0/lib/airbrake/user_informer.rb:16:in `_call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/airbrake-4.1.0/lib/airbrake/user_informer.rb:12:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-timeout-0.1.1/lib/rack/timeout.rb:104:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-mini-profiler-0.9.2/lib/mini_profiler/profiler.rb:193:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/engine.rb:514:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application.rb:144:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/builder.rb:138:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/urlmap.rb:65:in `block in call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `each'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `call'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/rack-test-0.6.3/lib/rack/test.rb:58:in `get'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:60:in `process'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:38:in `block in process_and_follow_redirects'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:37:in `times'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:37:in `process_and_follow_redirects'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:21:in `visit'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/capybara-2.4.4/lib/capybara/rack_test/driver.rb:42:in `visit'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/capybara-2.4.4/lib/capybara/session.rb:227:in `visit'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/capybara-2.4.4/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
# ./spec/features/authentication_spec.rb:7:in `block (3 levels) in <top (required)>'
# ./spec/support/background_jobs.rb:14:in `block (3 levels) in <top (required)>'
# ./spec/support/background_jobs.rb:5:in `run_background_jobs_immediately'
# ./spec/support/background_jobs.rb:13:in `block (2 levels) in <top (required)>'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/zeus-0.15.2/lib/zeus/rails.rb:208:in `test'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/zeus-0.15.2/lib/zeus.rb:148:in `block in command'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/zeus-0.15.2/lib/zeus.rb:135:in `fork'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/zeus-0.15.2/lib/zeus.rb:135:in `command'
# /Users/sasha/.rvm/gems/ruby-2.1.2/gems/zeus-0.15.2/lib/zeus.rb:50:in `go'
Updates
Following coreyward's advice, I set the Rack timeout to 25 seconds and set up some profiling tools. The increase in the timeout (which was dev-environment specific) made the problem go away on localhost. But, perplexingly, I didn't seem to experience any load times of 5+ seconds at all, according to NewRelic and MiniProfiler. I think the longest load time I got was around 3 seconds, and I only got that once. I improved a query, and didn't bump into load times that high again. So it's weird that I bumped into that 5-second limit.
Basically, the load time problem seemed to disappear when I increased the Rack timeout. But I there's still something weird going on, cause the feature tests will still time out in Continuous Integration tests and occasionally on local .
I since cleaned up my asset situation (got rid of Bower and NPM, and did everything through the Gemfile, usually using the Rails-Assets gem). I also upgraded to Rails 4.2 and Ruby 2.2 for performance enhancements. Things generally appear to load a bit faster, according to profiling.
But I'm still getting the same test failures. Interestingly, on my Continuous Integration tool, the tests pretty much always fail, and when they do, they fail with a different error (I captured with a screenshot).
Internal Server Error
could not obtain a database connection within 5.000 seconds (waited 5.000 seconds)
________________________________
WEBrick/1.3.1 (Ruby/2.2.0/2014-12-25) at 127.0.0.1:47539
This suggests it's a DB issue. My DB set up (database.yml) for the Test environment (which my CI uses) is below:
adapter: postgresql
database: planit_development
encoding: utf8
host: localhost
min_messages: warning
pool: 2
timeout: 5000
But, weirdly, my local test suite, which has the same settings, tends to pass (unless I mess with an asset file, in which case there's a chance a feature spec will fail on the first, but not subsequent, run(s)). And the tests that are failing are the least database-intensive tests in the whole suite (just basic auth flow testing).
The profiling definitely helped me fix some mistakes, but I'm still pretty stumped here about what's the root cause of what appears to be a continuing problem. Any ideas based on this new info? Or any sense of what else I should look into?
There are a number of ways to debug this. To start, increase the Rack::Timeout time to 25 seconds — while this might seem like it's going to make matters worse, it will allow you to accurately assess the actual time the request is taking (5.1s is a different story than 25s).
Instrument a monitoring tool like NewRelic or Skylight. The former is more popular and can be easily configured to log traces on all requests over a certain threshold. This will allow you to see (roughly) where the time is being spent, as well as parameters/request information that relates to it.
If you think that the requests that are failing are to assets, I would double check that you have asset compilation turned off in production. You want this in production.rb:
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
This means that you need to make every asset you're serving precompile. You can test that your setup is correct by running rake assets:precompile and verifying that the output in public/assets is what you're anticipating.
Make sure you're also outputting logs somewhere you can access them later — I prefer Papertrail, but there are undoubtedly others. This will allow you to find errors when they occur, especially 404s (which is what you'll see if you have requests for assets that are not precompiled). Once you isolate and resolve the issue you can lower this, but I still wouldn't set it lower than 15s.
Garbage collection is another potential culprit for intermittently long request times, though 5 seconds is probably excessive. Newer versions of Ruby (notably, 2.2) are better about managing this, so if you can bump the version you're using that might improve things.
Good luck!

Rails: AbstractController::Helpers::MissingHelperError - Missing helper file application_helper.rb_helper.rb

Can't find any resource that's helped me in this! When I try to 'rails s' and go to any page of the app; it shoots me this error page saying I am missing helper files.
I think it's local on my desktop machine because I recently did some work to the app on my laptop. I pushed from the laptop and app works fine on Heroku and runs local on that machine with zero problems. I added a feature to upload company logo images using Carrierwave, Mini_Magick, and Fog to Amazon S3.
Things I've tried so far: I've deleted the app and git clone it back to this machine. I've tried Brew uninstall/install imagemagick and did all the basics like bundle install, rake db:migrate after I cloned the app. Still no luck..
Here is the error codes I am getting on the page and also the full trace:
AbstractController::Helpers::MissingHelperError in PagesController#dashboard
Missing helper file helpers//users/jamesfend/sites/feedbackz/app/helpers/application_helper.rb_helper.rb
Extracted source (around line #1):
1 class ApplicationController < ActionController::Base
2 # Prevent CSRF attacks by raising an exception.
3 # For APIs, you may want to use :null_session instead.
4 protect_from_forgery with: :exception
Full Trace
actionpack (4.2.0) lib/abstract_controller/helpers.rb:151:in `rescue in block in modules_for_helpers'
actionpack (4.2.0) lib/abstract_controller/helpers.rb:148:in `block in modules_for_helpers'
actionpack (4.2.0) lib/abstract_controller/helpers.rb:144:in `map!'
actionpack (4.2.0) lib/abstract_controller/helpers.rb:144:in `modules_for_helpers'
actionpack (4.2.0) lib/action_controller/metal/helpers.rb:93:in `modules_for_helpers'
actionpack (4.2.0) lib/abstract_controller/helpers.rb:108:in `helper'
actionpack (4.2.0) lib/action_controller/railties/helpers.rb:17:in `inherited'
app/controllers/application_controller.rb:1:in `<top (required)>'
activesupport (4.2.0) lib/active_support/dependencies.rb:457:in `load'
activesupport (4.2.0) lib/active_support/dependencies.rb:457:in `block in load_file'
activesupport (4.2.0) lib/active_support/dependencies.rb:647:in `new_constants_in'
activesupport (4.2.0) lib/active_support/dependencies.rb:456:in `load_file'
activesupport (4.2.0) lib/active_support/dependencies.rb:354:in `require_or_load'
activesupport (4.2.0) lib/active_support/dependencies.rb:494:in `load_missing_constant'
activesupport (4.2.0) lib/active_support/dependencies.rb:184:in `const_missing'
app/controllers/pages_controller.rb:1:in `<top (required)>'
activesupport (4.2.0) lib/active_support/dependencies.rb:457:in `load'
activesupport (4.2.0) lib/active_support/dependencies.rb:457:in `block in load_file'
activesupport (4.2.0) lib/active_support/dependencies.rb:647:in `new_constants_in'
activesupport (4.2.0) lib/active_support/dependencies.rb:456:in `load_file'
activesupport (4.2.0) lib/active_support/dependencies.rb:354:in `require_or_load'
activesupport (4.2.0) lib/active_support/dependencies.rb:494:in `load_missing_constant'
activesupport (4.2.0) lib/active_support/dependencies.rb:184:in `const_missing'
activesupport (4.2.0) lib/active_support/inflector/methods.rb:261:in `const_get'
activesupport (4.2.0) lib/active_support/inflector/methods.rb:261:in `block in constantize'
activesupport (4.2.0) lib/active_support/inflector/methods.rb:259:in `each'
activesupport (4.2.0) lib/active_support/inflector/methods.rb:259:in `inject'
activesupport (4.2.0) lib/active_support/inflector/methods.rb:259:in `constantize'
activesupport (4.2.0) lib/active_support/dependencies.rb:566:in `get'
activesupport (4.2.0) lib/active_support/dependencies.rb:597:in `constantize'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:69:in `controller_reference'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:59:in `controller'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:38: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'
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.6.0) lib/rack/etag.rb:24:in `call'
rack (1.6.0) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.0) lib/rack/head.rb:13: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.0) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.0) 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'
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.0) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.0) 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.0) lib/rack/lock.rb:17:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.0) lib/rack/sendfile.rb:113: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.0) lib/rack/lock.rb:17:in `call'
rack (1.6.0) lib/rack/content_length.rb:15:in `call'
rack (1.6.0) lib/rack/handler/webrick.rb:89:in `service'
/Users/jamesfend/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/Users/jamesfend/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/Users/jamesfend/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
Pages Controller
class PagesController < ApplicationController
def dashboard
#title = 'Feedbackz by Amazio Labs'
#header_title = 'Dashboard'
end
def billing
#title = 'Billing & Plans - Feedbackz by Amazio Labs'
#header_title = 'Billing & Plans'
#user = User.find(current_user.id)
end
def contact
#title = 'Contact - Feedbackz by Amazio Labs'
#header_title = 'Contact Us'
end
def faq
#title = 'FAQ - Feedbackz by Amazio Labs'
#header_title = 'Frequently Asked Questions'
end
def invoices
#title = 'Invoices - Feedbackz by Amazio Labs'
#header_title = 'Invoices'
end
def videos
#title = 'Videos - Feedbackz by Amazio Labs'
#header_title = 'Helpful Videos'
end
def schedule
#title = 'Schedule - Feedbackz by Amazio Labs'
#header_title = 'Schedule of Pending Sends'
end
end
This worked for me:
cd ~
mv sites tmpsites
mv tmpsites sites
I also did this, but am unsure if it was required:
cd /
sudo ln -s Users users
Oddly, I can't see the lowercase users symlink, but both ls /users and ls /Users work.
I solved with "spring stop" in the console.
Step-by-Step Guide:
On OSX, I had changed my username to Psy from psy. So figuring the problem out was a pain in the ass. Following these steps helped me out:
Run irb and execute this command in your project folder:
File.expand_path("./")
# => "/Users/psy/code/rails_app"
Now exit irb and run this command in your shell:
$ pwd
# => /Users/Psy/code/rails_app
Compare the two and notice the directory with the case difference, in this case it's Psy
Rename that directory to anything, and then rename it back to the original folder (use sudo only if necessary)
$ sudo mv /Users/Psy /Users/tmp
$ sudo mv /Users/tmp /Users/Psy
While the answer Zubin provided worked for me on my personal machine I just ran into the same issue on a work machine where it didn't exactly. I'd created sites as a lowercase dir:
mkdir sites
Renaming with a capital s fixed it.
mv sites Sites
I found that renaming only the sites folder worked for me just like Zubin pointed out. I did not do the sudo ln command.
mv sites sites1
mv sites1 sites
Simply moving/renaming the folder didn't work for me. I had to rename the existing folder, create a new folder with the same name, then copy everything to it. Then I deleted the old renamed folder.
For me this issue was caused because I was using GitBash on Windows, and running my tests from there. Looks like a case mismatch on what bash is expecting vs the actual folder names. Ran it from cmd and worked fine.
If you are using Windows and Powershell, this issue can occur when running rails s or rails server from a directory which has a certain capitalisation in the filesystem, but if you have changed into the directory in Powershell using a different capitalisation.
For example on my Windows filesystem my rails site is located at:
C:/Code/Personal-Website
however I ran the following commands in powershell to start my server:
C:\Users\XXX XXX> cd C:/code/personal-website
C:\code\personal-website> rails s
This case mismatch between where Powershell thinks it is starting the server versus where the server's document root actually is in the filesystem seems to cause the problem, and ensuring that your Powershell location case matches that of the directories in Windows will stop it.
I get this error while running rails s on windows powershell but not on cmd.
I sugest using a different CLI.
I got the same error as above, but it was not due to a case issue. It ended up being due to a combination of things. I had two ruby version managers installed- rvm and rbenv- and I was using an old gem installer. I had to uninstall rvm (How can I remove RVM (Ruby Version Manager) from my system?) and reinstall rbenv (brew reinstall rbenv)and upgrade to the lastest version of ruby. Then I had to update rubygems (gem update --system). Then, reinstalled all gems and a reboot and everything was fixed.
Essentially, my ruby manager was pointing to an old version of ruby and using an outdated version of the gem installer (2.2.0). You might be able to fix things with just an upgrade to rubygems.
It took me a day and a half to get this resolved. Hopefully, this will save someone some time and frustration.
I started getting the same missing helper message when running tests, even though my app ran OK in dev mode. And this started right after I had run my tests successfully, with no system changes that I was aware of. After trying the suggestion to remove uppercase filenames from my path without success, I ran rvm, in my case
rvm use ruby-2.2.0#rails4.2
bundle install
The problem went away. I suspect my system had rebooted and started using some incompatible system Ruby module. I am a beginner working my way through Michael Hartl's rails tutorial on OS X 10.10.3.
I also encountered this error. All the solutions here didn't work out and I tried different things. Here's my solution which might help others too:
In my project path there was a folder with a vowel mutation / "Umlaut" (ü, ö, ä etc.).
So I changed that and everything worked.
This isn't really a ruby or Rails bug as it is a flaw in OSX (IMHO) resulting from a design decision made many years ago to maintain compatibility with OS 8.0 (classic MacOS) and provide better compatability with Windows FAT/NTFS. That decision was to implement HFS+ with a case preserving but case insensitive naming schema wherein the following paths are equivalent:
/tmp/CASE_insensitive
/tmp/case_INSENSITIVE
You can read more about this in the following quora post:
Why does OS X choose to have a case-insensitive file system instead of a case-sensitive one?
If you've ever configured an HFS+ filesystem to enforce case insensitivity (you know, to be more compatible with actual *nix filesystems) you may very well come across software that just breaks on OSX because that software has been somewhat carelessly written to assume no case insensitivity (IIRC, some Adobe software had great trouble with HFS+ with case sensitivity).
Try this in the OSX terminal:
prompt>mkdir /tmp/CASE_insensitive
prompt>cd /tmp/case_INSENSITIVE
prompt>pwd
/tmp/case_INSENSITIVE
IMHO, that's pretty messed up. Now, if you're using Pow on your OSX system, when you create the symlink in the ~/.pow directory to point to your Rails app, be careful of the case. Mis-typing the case here will result in the error noted by the OP. Simply removing and renaming the symlink with the appropriate case will fix this properly.
I got this error from
rails g controller Name
I just deleted the controller with
rails d controller Name
Then generated it again with lowercase
rails g controller name

Rails 4.0.0 - Got "no implicit conversion of nil into String"

Just installed a brand new Rails 4.0.0 app and I got this error (https://gist.github.com/hartator/6404820) on http://0.0.0.0:3000:
no implicit conversion of nil into String
activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `initialize'
activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `new'
activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `sqlite3_connection'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout'
/Users/asa/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
/Users/asa/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
activerecord (4.0.0) lib/active_record/connection_handling.rb:79:in `retrieve_connection'
activerecord (4.0.0) lib/active_record/connection_handling.rb:53:in `connection'
My database.yml: http://pastebin.com/JM5TNmNU
I haven't done anything yet to the vanilla rails code. Any idea what could be the issue?
Using:
Rails 4.0.0
Ruby 2.0.0p195
Mountain Lion 10.8.2
That sounds like a problem with your sqlite3 gem installation. Try:
gem pristine sqlite3
From the RubyGems documentation:
gem pristine
Restores installed gems to pristine condition from files located in the gem cache
Usage
gem pristine [GEMNAME ...] [options]
http://guides.rubygems.org/command-reference/#gem_pristine

Rails, Ruby 1.9.3p0, and mysql gem

I'm running CentOS6 and installed Ruby from source, along with Rails and some other staff.
ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
rails -v
Rails 3.1.3
Some gems:
*** LOCAL GEMS ***
actionmailer (3.1.3, 2.3.14)
actionpack (3.1.3, 2.3.14)
activemodel (3.1.3)
activerecord (3.1.3, 2.3.14)
activeresource (3.1.3, 2.3.14)
activesupport (3.1.3, 2.3.14)
archive-tar-minitar (0.5.2)
arel (2.2.1)
bigdecimal (1.1.0)
bouncy-castle-java (1.5.0146.1)
builder (3.0.0)
bundler (1.0.21)
coderay (0.9.7)
columnize (0.3.5)
edavis10-object_daddy (0.4.3)
erubis (2.7.0)
fastercsv (1.5.0)
ffi (1.0.11)
hike (1.2.1)
hoe (2.12.4)
i18n (0.6.0, 0.4.2)
io-console (0.3)
jruby-openssl (0.7.4)
json (1.5.4)
linecache19 (0.5.13)
mail (2.3.0)
metaclass (0.0.1)
mime-types (1.17.2)
minitest (2.5.1)
mocha (0.10.0)
multi_json (1.0.4)
mysql (2.8.1)
mysql2 (0.3.11, 0.2.7)
net-ldap (0.2.2)
polyglot (0.3.3)
rack (1.3.5, 1.1.2)
rack-cache (1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.3, 2.3.14)
railties (3.1.3)
rake (0.9.2.2)
rdoc (3.9.4)
rmagick (2.13.1)
ruby-debug-base19 (0.11.26, 0.11.25)
ruby-debug19 (0.11.6)
ruby-mysql (2.9.4)
ruby-openid (2.1.4)
ruby_core_source (0.1.5)
rubygems-update (1.8.12)
rubytree (0.5.2)
shoulda (2.11.3, 2.10.3)
sprockets (2.0.3)
sqlite3 (1.3.5, 0.1.1)
sqlite3-ruby (1.3.3, 1.2.5)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
I need Rails in order to run chiliproject, but when running the following command
RAILS_ENV=production bundle exec rake db:migrate
I get:
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
cannot load such file -- mysql
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Now with --trace:
RAILS_ENV=production bundle exec rake db:migrate --trace >> tmp/rake
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
cannot load such file -- mysql
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/kernel/requires.rb:7:in `block in require_library_or_gem'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/kernel/requires.rb:5:in `require_library_or_gem'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/mysql_adapter.rb:61:in `mysql_connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `block (2 levels) in checkout'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `block in checkout'
/usr/local/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'
/var/www/html/chiliproject/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:218:in `quoted_left_column_name'
/var/www/html/chiliproject/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:94:in `acts_as_nested_set'
/var/www/html/chiliproject/app/models/issue.rb:33:in `'
/var/www/html/chiliproject/app/models/issue.rb:15:in `'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:291:in `require_or_load'
/var/www/html/chiliproject/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb:133:in `require_or_load_with_engine_additions'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:451:in `load_missing_constant'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:106:in `const_missing_with_dependencies'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:118:in `const_missing'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/inflector.rb:375:in `const_get'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/inflector.rb:375:in `block in constantize'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/inflector.rb:374:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/inflector.rb:374:in `constantize'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/string/inflections.rb:162:in `constantize'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:157:in `observed_class'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:183:in `observed_classes'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:166:in `initialize'
/usr/local/lib/ruby/1.9.1/singleton.rb:141:in `new'
/usr/local/lib/ruby/1.9.1/singleton.rb:141:in `block in instance'
:10:in `synchronize'
/usr/local/lib/ruby/1.9.1/singleton.rb:139:in `instance'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:38:in `block in instantiate_observers'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:36:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:36:in `instantiate_observers'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:15:in `block in define_dispatcher_callbacks'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:182:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:182:in `evaluate_method'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:166:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:90:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:90:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:90:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:276:in `run_callbacks'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:51:in `run_prepare_callbacks'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/initializer.rb:631:in `prepare_dispatcher'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/initializer.rb:185:in `process'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/initializer.rb:113:in `run'
/var/www/html/chiliproject/config/environment.rb:39:in `'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `block in require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:in `new_constants_in'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/tasks/misc.rake:4:in `block in '
/usr/local/lib/ruby/1.9.1/rake/task.rb:205:in `call'
/usr/local/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
/usr/local/lib/ruby/1.9.1/rake/task.rb:200:in `each'
/usr/local/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
/usr/local/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/rake/task.rb:176:in `block in invoke_prerequisites'
/usr/local/lib/ruby/1.9.1/rake/task.rb:174:in `each'
/usr/local/lib/ruby/1.9.1/rake/task.rb:174:in `invoke_prerequisites'
/usr/local/lib/ruby/1.9.1/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
/usr/local/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
/usr/local/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/lib/ruby/1.9.1/rake/application.rb:94:in `each'
/usr/local/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
/usr/local/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
/usr/local/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
/usr/local/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/usr/local/bin/rake:32:in `'
Tasks: TOP => db:migrate => environment
Does anyone knows what's wrong with mysql gem files?
I also tried to install mysql gem files like this
gem install ruby-mysql2 --no-rdoc --no-ri -- --with-mysql-config=/usr/bin/mysql_config
I was just having similar problems and you may be doing what I was: I was using 'gem list' to determine what was installed (it lists *** LOCAL GEMS *** just like you show) and I saw mysql, but the Gemfile for my project was not requiring bundler to install mysql.
If you just type bundle show does it list 'mysql'? If not, then the Gemfile in chiliproject is not causing bundler to install mysql. I found this all very confusing until I realized I was confusing different ways of managing what gems are installed.
If you or others who comes this way are having the same issue, then perhaps this is helpful. (And perhaps this poor explanation will encourage one of the rails gurus to elaborate for us.)
To say it another way, the list of your locally installed gems, isn't the same as the list installed in your app's bundle of gems (hence where the name of the bundler tool comes from). When you're running your app, and managing its dependencies with bundler you have to do everything within the bundler scope, in order to make sure it all works together. When you do that it's actually very straight forward and solves a lot of problems for you, but if you're coming from previous experience on apps that didn't use bundler then it just takes a little getting used to.
2 steps that worked for me:
Copy the file libmySQL.dll from /libhttp://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick (in the folder /lib/) in c:/your/path/to/ruby/bin (Make sure your ruby bin is in your system PATH environnement variable)
The Default setup is given for MySQL with ruby1.8. If you're running Redmine with MySQL and ruby1.9, replace the adapter name with mysql2 in your /config/database.yml file
http://www.redmine.org/issues/10566
Just on bundle install try this >>
bundle install --without=test development sqlite postgres mysql rmagick
This will install all required base dependencies, the mysql2 database adapter
Cause mysql adapter is not compatible with Ruby 1.9
And don't forget to change config/database.yml --> s/mysql/mysql2
\o/

Resources