refinerycms image not loading - dragonfly error - ruby-on-rails

I'm working on developing a refinerycms rails app that was working good locally and now i've moved it to my VPS and I was having issues with images that i uploaded through refinerycms not loading and i've been reading that i needed to upgrade my version of imagemagick. I upgraded from 6.2.8 to 6.7.8. Now the images all load on some pages, but not on the admin side.
What is causing this issue? Here's the stacktrace of the error.
Dragonfly::Shell::CommandFailed (Command failed (convert '/var/www/vhosts/tomstestsite.us/PersonalTrainingKT/public/system/refinery/images/2012/06/03/16_36_48_339_pamLemke_after.jpg' '-resize' '225x255>' '/tmp/dragonfly20120705-7812-1xb3pce') with exit status 127):
dragonfly (0.9.12) lib/dragonfly/shell.rb:29:in `raise_shell_command_failed'
dragonfly (0.9.12) lib/dragonfly/shell.rb:23:in `run'
dragonfly (0.9.12) lib/dragonfly/image_magick/utils.rb:17:in `convert'
dragonfly (0.9.12) lib/dragonfly/image_magick/processor.rb:103:in `convert'
dragonfly (0.9.12) lib/dragonfly/image_magick/processor.rb:27:in `resize'
dragonfly (0.9.12) lib/dragonfly/image_magick/processor.rb:87:in `thumb'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `call'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `block (2 levels) in call_last'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `catch'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `block in call_last'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `each'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `call_last'
dragonfly (0.9.12) lib/dragonfly/processor.rb:5:in `process'
dragonfly (0.9.12) lib/dragonfly/job.rb:79:in `apply'
dragonfly (0.9.12) lib/dragonfly/job.rb:253:in `block in apply'
dragonfly (0.9.12) lib/dragonfly/job.rb:253:in `each'
dragonfly (0.9.12) lib/dragonfly/job.rb:253:in `apply'
dragonfly (0.9.12) lib/dragonfly/response.rb:25:in `to_response'
dragonfly (0.9.12) lib/dragonfly/server.rb:43:in `block in call'
dragonfly (0.9.12) lib/dragonfly/server.rb:39:in `catch'
dragonfly (0.9.12) lib/dragonfly/server.rb:39:in `call'
dragonfly (0.9.12) lib/dragonfly/middleware.rb:11:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.3) lib/rails/engine.rb:479:in `call'
railties (3.2.3) lib/rails/application.rb:220:in `call'
railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
passenger (3.0.11) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `block in handle_spawn_application'
passenger (3.0.11) lib/phusion_passenger/utils.rb:479:in `safe_fork'
passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:219:in `block (2 levels) in spawn_rails_application'
passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:214:in `block in spawn_rails_application'
passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.11) helper-scripts/passenger-spawn-server:99:in `<main>'
UPDATE
I've added the code below to my config/application.rb file as suggested here and it helped some of the files show up, and but i'm still unable to upload a file through the app and part of this stacktrace is shown below.
config/application.rb contains this
initializer 'override-image-magick-paths', :after => 'attach-refinery-images-with-
dragonfly' do
app=Dragonfly[:refinery_images]
app.configure_with(:imagemagick)
app.configure do |c|
c.convert_command = "/usr/local/bin/convert" # defaults to "convert"
c.identify_command = "/usr/local/bin/identify" # defaults to "identify"
end
end
stacktrace
Dragonfly::Shell::CommandFailed (Command failed (identify '/tmp/RackMultipart20120708-20096-4m1k9j') with exit status 127):
dragonfly (0.9.12) lib/dragonfly/shell.rb:29:in `raise_shell_command_failed'
dragonfly (0.9.12) lib/dragonfly/shell.rb:23:in `run'
dragonfly (0.9.12) lib/dragonfly/image_magick/utils.rb:34:in `raw_identify'
dragonfly (0.9.12) lib/dragonfly/image_magick/utils.rb:24:in `identify'
dragonfly (0.9.12) lib/dragonfly/image_magick/analyser.rb:44:in `format'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `call'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `block (2 levels) in call_last'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `catch'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `block in call_last'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `each'
dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `call_last'
dragonfly (0.9.12) lib/dragonfly/analyser.rb:25:in `analyse'
dragonfly (0.9.12) lib/dragonfly/job.rb:247:in `analyse'

I simply reinstalled imagemagick and it worked.

I created a symbolic link from /usr/bin/convert -> /usr/local/bin/convert and from /usr/bin/identify -> /usr/local/bin/identify and that seemed to solve my problems.
$ cd /usr/bin
$ ln -s /usr/local/bin/convert convert
$ ln -s /usr/local/bin/identify identify
I'm assuming that dragonfly is still not picking up my location of convert and identify even though i specified it in my config/application.rb file.

You may have to provide the full path to convert:
config/initializers/dragonfly.rb:
app.configure do |c|
c.convert_command = "/usr/bin/convert"
end
Change /usr/bin/convert to the correct path to convert, which you can find out by running whereis convert on your VPS shell.
More details in the documentation.

Try installing the refinery-images gem:
Gemfile:
gem 'refinerycms-page-images', '~>1.0.3' //refinery v1 compatible (v2 available also)
Then in your model:
belongs_to :imagesizeyouwant, :class_name => 'Image'
If you look at the Image class you'll see a pretty nice set up for handling images. You can add image sizes in Refinery's Settings page in the admin tool. If you have a custom engine, just change :imagesizeyouwant to that size (mine was :thumbnail).
When you post the image, look at the output of the identify command and try to run it on your own. Chances are your system has different parameters it uses for ImageMagick binaries, or that the dimensions being sent to it are not understood. Try posting the output of the actual command Dragonfly is calling in the shell so we can take a better look.

Related

Error with Phusion Passenger while setting up Rails on Ubuntu Server

I need help getting a rails app running on an Ubuntu 11.10 Server.
I have been at it for about 2 days and can't get past the part shown in the screen shot here. I have rvm, rails, ruby, capistrano, fusion passenger all installed correctly as far as I can tell. I think the issue I have has to do with the database (mysql) or getting rails to talk to the database (I'm just making a guess from the error messages below).
Error message:
undefined method `active_record' for #<Rails::Application::Configuration:0x00000002e43fe8>
Exception class:
NoMethodError
Application root:
/var/www/jamesbay/blog/current
My main question is how can I go about debugging this?
I have tried modifying the config.ru file, application.rb, and environment.rb as listed with no resolution. I'm not entirely sure what these errors even imply!
I have capistrano deploying to my directory on the server properly.
I can make updates to a git repo and use the various 'cap' commands to handle the actual deployment from local machine to server.
Any help is appreciated! (I have only been using rails for about 2 weeks and I have already learned a TON about server management due to this project)
Errors
0 /usr/local/rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/railtie/configuration.rb 85 in `method_missing'
1 /home/jamesbay/blog/releases/20121026055113/config/application.rb 54 in `'
2 /home/jamesbay/blog/releases/20121026055113/config/application.rb 13 in `'
3 /home/jamesbay/blog/releases/20121026055113/config/application.rb 12 in `'
4 /home/jamesbay/blog/releases/20121026055113/config/environment.rb 2 in `require'
5 /home/jamesbay/blog/releases/20121026055113/config/environment.rb 2 in `'
6 config.ru 3 in `require'
7 config.ru 3 in `block in '
8 /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb 51 in `instance_eval'
9 /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb 51 in `initialize'
10 config.ru 1 in `new'
11 config.ru
Setup
Rails 3.2.8
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
rvm 1.16.17 (stable)
Capistrano 2.13.4
Phusion Passenger 3.0.17
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p194
- RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p194/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/rvm/gems/ruby-1.9.3-p194
- /usr/local/rvm/gems/ruby-1.9.3-p194#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
Gems used
actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8)
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.4)
bundler (1.2.1)
capistrano (2.13.4)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.4.0)
erubis (2.7.0)
execjs (1.4.0)
highline (1.6.15)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.1.3)
json (1.7.5)
mail (2.4.4)
mime-types (1.19)
multi_json (1.3.6)
mysql2 (0.3.11)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.6.1)
net-ssh-gateway (1.1.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.8)
railties (3.2.8)
rake (0.9.2.2)
rdoc (3.12)
rubygems-bundler (1.1.0)
rvm (1.11.3.5)
sass (3.2.1)
sass-rails (3.2.5)
sprockets (2.1.3)
sqlite3 (1.3.6)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.11)
tzinfo (0.3.33)
uglifier (1.3.0)
--
This is what shows up in the log file after opening the app in a browser just now:
[Fri Oct 26 07:46:15 2012] [notice] Graceful restart requested, doing restart
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/gd.so' - /usr/lib/php5/20090626/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mcrypt.so' - /usr/lib/php5/20090626/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0
[Fri Oct 26 07:46:15 2012] [notice] Apache/2.2.20 (Ubuntu) DAV/2 SVN/1.6.12 PHP/5.3.6-13ubuntu3.7 with Suhosin-Patch Phusion_Passenger/3.0.17 configured -- resuming normal operations
[ pid=30885 thr=4411480 file=utils.rb:176 time=2012-10-26 12:56:40.708 ]: *** Exception NoMethodError in PhusionPassenger::Rack::ApplicationSpawner (undefined method `active_record' for #<Rails::Application::Configuration:0x00000001931f38>) (process 30885, thread #<Thread:0x0000000086a0b0>):
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/railtie/configuration.rb:85:in `method_missing'
from /home/jamesbay/blog/releases/20121026055113/config/application.rb:54:in `<class:Application>'
from /home/jamesbay/blog/releases/20121026055113/config/application.rb:13:in `<module:Blog>'
from /home/jamesbay/blog/releases/20121026055113/config/application.rb:12:in `<top (required)>'
from /home/jamesbay/blog/releases/20121026055113/config/environment.rb:2:in `require'
from /home/jamesbay/blog/releases/20121026055113/config/environment.rb:2:in `<top (required)>'
from config.ru:3:in `require'
from config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from config.ru:1:in `new'
from config.ru:1:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:225:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:225:in `load_rack_app'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:157:in `block in initialize_server'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/utils.rb:563:in `report_app_init_status'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:154:in `initialize_server'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:204:in `start_synchronously'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:180:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
from <internal:prelude>:10:in `synchronize'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/helper-scripts/passenger-spawn-server:99:in `<main>'
After switching to rails 1.9.3-p194 (same as my dev machine) and removing p286, I get a message saying "the page you were looking for doesn't exist" in RED when I goto my site.
This is the output of the error.log file:
Rails Error: Unable to access log file. Please ensure that /home/jamesbay/blog/releases/20121026205006/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
ActionController::RoutingError (No route matches [GET] "/jamesbay"):
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
railties (3.2.8) lib/rails/railtie/configurable.rb:30:in `method_missing'
passenger (3.0.17) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.17) lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
passenger (3.0.17) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.17) lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
passenger (3.0.17) lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
passenger (3.0.17) lib/phusion_passenger/utils.rb:470:in `safe_fork'
passenger (3.0.17) lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
passenger (3.0.17) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.17) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.17) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.17) lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
passenger (3.0.17) lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
passenger (3.0.17) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.17) lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
passenger (3.0.17) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
passenger (3.0.17) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.17) lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
passenger (3.0.17) lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
passenger (3.0.17) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.17) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.17) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.17) helper-scripts/passenger-spawn-server:99:in `<main>'
I ended up resolving my issue.
The primary issue was due to having multiple versions of ruby installed and managed with rvm.
This coupled with not properly initializing my database AND not setting up my apache paths properly led to the errors.
My default ruby version was set to ruby-1.9.3-p286 but I was using ruby-1.9.3-p194 on my development machine. I had previously installed both versions on the server but didn't pick a default. Make sure you pick a default version before deployment.
I am using sub URI's and I hadn't set up the paths properly with symlinks. For example, I have my application files inside /home/username/appName, with the public directory living at /home/username/appName/current/public. Inside my DocumentRoot, /var/www I created a symlink called 'appName' that points to the public directory path. Where I messed up was in not defining the RackBasedURI path in my /etc/apache2/sites-available/default file.
This process is referenced here:
http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rack_to_sub_uri

Rails routing error. Application doesn't run

Heyy guys, please help me. I am from 4 days on dreamhost setting up rails. Finally rails has started working but application is not running. I have just deployed a demo app with only one model Products and the page doesn't opens, it says page doesn't exist. There is written routing error in production log file. I am novice in Rails so could'nt figure out what is going wrong. You can try yourself running app http://meropati.com/products and see source code of this app with log files on my git repository *https://github.com/getaasciesh/TestingRailsOnDreamHost*
I will be so thankful to get it's solution.
Started GET "/products" for 208.113.229.116 at 2012-07-26 16:05:55 -0700
ActionController::RoutingError (No route matches [GET] "/products"):
actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.6) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.6) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
railties (3.2.6) lib/rails/engine.rb:479:in `call'
railties (3.2.6) lib/rails/application.rb:220:in `call'
railties (3.2.6) lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/utils.rb:470:in `safe_fork'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server.rb:180:in `start'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/getaasciesh3/.passenger/standalone/3.0.14-x86_64-ruby1.9.3-linux-gcc4.4.5-1002/support/helper-scripts/passenger-spawn-server:99:in `<main>'
This might not matter, but you've got:
gem 'sqlite3'
group :development, :test do
gem 'sqlite3'
end
...
gem 'mysql2'
Try removing the first reference to sqlite3 as you don't want it in production.
As I said, it might not make any difference to this particular issue, but it will save you from trouble later on
Update
The dreamhost wiki advise against using passenger and rvm, as they don't play too nicely together. Read the section titled "Troubleshooting". They recommend switching to the system installation of ruby.
If you are going to try that, you will probably need to remove the reference to rvm from environment.rb
Good luck

"undefined method `process_route'" when going to resque web ui

I just started getting this error when going to the Resque web ui on my server. It does not happen locally, and it did not happen before some recent app changes/upgrades I made. I made no changes to the server itself. I could start reverting back changelists to see where it broke, but I upgraded a lot of gems at once so I have a hunch it'll be quite tricky.
So, any idea what would cause this or where it might be originating?
The path I'm going to is mydomain.com/app/resque
routes.rb
scope :path => "/app" do
mount Resque::Server.new, :at => '/resque'
end
NoMethodError (undefined method `process_route' for #<Resque::Server:0x00000005dc95b0>):
newrelic_rpm (3.3.4.1) lib/new_relic/agent/instrumentation/sinatra.rb:38:in `block in dispatch_with_newrelic'
newrelic_rpm (3.3.4.1) lib/new_relic/agent/instrumentation/sinatra.rb:62:in `block in transaction_name'
newrelic_rpm (3.3.4.1) lib/new_relic/agent/instrumentation/sinatra.rb:61:in `each'
newrelic_rpm (3.3.4.1) lib/new_relic/agent/instrumentation/sinatra.rb:61:in `transaction_name'
newrelic_rpm (3.3.4.1) lib/new_relic/agent/instrumentation/sinatra.rb:37:in `dispatch_with_newrelic'
sinatra (1.0) lib/sinatra/base.rb:411:in `block in call!'
sinatra (1.0) lib/sinatra/base.rb:566:in `instance_eval'
sinatra (1.0) lib/sinatra/base.rb:566:in `block in invoke'
sinatra (1.0) lib/sinatra/base.rb:566:in `catch'
sinatra (1.0) lib/sinatra/base.rb:566:in `invoke'
sinatra (1.0) lib/sinatra/base.rb:411:in `call!'
sinatra (1.0) lib/sinatra/base.rb:399:in `call'
rack (1.4.1) lib/rack/auth/basic.rb:25:in `call'
sinatra (1.0) lib/sinatra/base.rb:979:in `block in call'
sinatra (1.0) lib/sinatra/base.rb:1005:in `synchronize'
sinatra (1.0) lib/sinatra/base.rb:979:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/mapper.rb:40:in `call'
journey (1.0.3) lib/journey/router.rb:68:in `block in call'
journey (1.0.3) lib/journey/router.rb:56:in `each'
journey (1.0.3) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `call'
omniauth (1.1.0) lib/omniauth/strategy.rb:177:in `call!'
omniauth (1.1.0) lib/omniauth/strategy.rb:157:in `call'
omniauth (1.1.0) lib/omniauth/builder.rb:48:in `call'
newrelic_rpm (3.3.4.1) lib/new_relic/rack/browser_monitoring.rb:23:in `call'
airbrake (3.0.9) lib/airbrake/rack.rb:27:in `call'
warden (1.1.1) lib/warden/manager.rb:35:in `block in call'
warden (1.1.1) lib/warden/manager.rb:34:in `catch'
warden (1.1.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
remotipart (1.0.2) lib/remotipart/middleware.rb:30:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__2652675143263662148__call__736553824066291236__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
rack-ssl (1.3.2) lib/rack/ssl.rb:27:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
airbrake (3.0.9) lib/airbrake/user_informer.rb:12:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
railties (3.2.1) lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb:479:in `safe_fork'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:180:in `start'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/local/rvm/gems/ruby-1.9.3-p0#global/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server:99:in `<main>'
You are combining a new version of new_relic with a very old version of sinatra. Run bundle update sinatra and make sure you have at least Sinatra 1.3.0, or try to downgrade the new_relic gem.
If you wonder why you have sinatra in your bundle at all: resque depends on it.
You could also add an explicite rule for a newer sinatra or an older new_relic to your Gemfile.
I resolved this by modifying my Gemfile to have the following lines:
gem 'sinatra', ">= 1.3.0"
gem 'newrelic_rpm'
gem 'resque'

New Rails App Fails loading assets

I'm trying to get a brand new skeleton app running in rails 3.1.0.rc8. However, whenever any asset tag/helper is used in a view(such as image_tag, javascript_include_tag, etc.), I get a asset compile error. Here's a snippet of my logs/development.log when I make a direct request to /assets/rails.png.
Started GET "/assets/rails.png" for 192.168.0.12 at Mon Aug 29 16:16:21 -0600 2011
Error compiling asset rails.png:
ArgumentError: wrong number of arguments (2 for 1)
activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `respond_to?'
activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `dump'
activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `write_entry'
activesupport (3.1.0.rc8) lib/active_support/core_ext/file/atomic.rb:20:in `atomic_write'
activesupport (3.1.0.rc8) lib/active_support/cache/file_store.rb:101:in `write_entry'
activesupport (3.1.0.rc8) lib/active_support/cache/strategy/local_cache.rb:140:in `write_entry'
activesupport (3.1.0.rc8) lib/active_support/cache.rb:364:in `write'
activesupport (3.1.0.rc8) lib/active_support/cache.rb:520:in `instrument'
activesupport (3.1.0.rc8) lib/active_support/cache.rb:362:in `write'
sprockets (2.0.0.beta.15) lib/sprockets/caching.rb:117:in `cache_set'
sprockets (2.0.0.beta.15) lib/sprockets/caching.rb:80:in `cache_set_hash'
sprockets (2.0.0.beta.15) lib/sprockets/caching.rb:51:in `cache_asset'
sprockets (2.0.0.beta.15) lib/sprockets/environment.rb:82:in `build_asset'
sprockets (2.0.0.beta.15) lib/sprockets/trail.rb:102:in `find_asset_in_path'
sprockets (2.0.0.beta.15) lib/sprockets/base.rb:102:in `find_asset'
sprockets (2.0.0.beta.15) lib/sprockets/environment.rb:72:in `find_asset'
sprockets (2.0.0.beta.15) lib/sprockets/server.rb:42:in `call'
rack-mount (0.8.2) lib/rack/mount/prefix.rb:26:in `call'
rack-mount (0.8.2) lib/rack/mount/route_set.rb:152:in `call'
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:96:in `recognize'
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:95:in `recognize'
rack-mount (0.8.2) lib/rack/mount/route_set.rb:141:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/routing/route_set.rb:531:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.3.2) lib/rack/etag.rb:23:in `call'
rack (1.3.2) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/flash.rb:243:in `call'
rack (1.3.2) lib/rack/session/abstract/id.rb:195:in `context'
rack (1.3.2) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/cookies.rb:326:in `call'
activerecord (3.1.0.rc8) lib/active_record/query_cache.rb:62:in `call'
activerecord (3.1.0.rc8) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/callbacks.rb:29:in `call'
activesupport (3.1.0.rc8) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
activesupport (3.1.0.rc8) lib/active_support/callbacks.rb:81:in `send'
activesupport (3.1.0.rc8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (3.1.0.rc8) lib/action_dispatch/middleware/reloader.rb:68:in `call'
rack (1.3.2) lib/rack/sendfile.rb:101:in `call'
I'm running ruby 1.8.7 and Passenger, if relevant. Anyone else running into this error?
Fixed this by upgrading from sprockets 2.0.0.beta.15 to 2.0.0:
gem install sprockets -v=2.0.0
Kudos to Ryan Bigg for the help.
I met the same problem when compiling assets via rake task:
$ bundle exec rake assets:precompile --trace
...
** Execute assets:precompile:primary
rake aborted!
wrong number of arguments (2 for 1)
/usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.0/lib/active_support/cache/file_store.rb:91:in `respond_to?'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.0/lib/active_support/cache/file_store.rb:91:in `dump'
...
after spending 4+ hours and tried many approaches, I found that it may be an issue of Ruby. ( from this link: https://github.com/resolve/refinerycms/issues/538 )
$ ruby -v
ruby 1.8.7 (2008-05-31 patchlevel 0)
Here the patchlevel 0 is the problem. since my ruby was compiled from the source code. (some reason I can't make it installed from package manager or via RVM).
Solution:
Download a new source file from http://ftp.ruby-lang.org/pub/ruby/1.8/, e.g. patch 358 ,
compile it:
unzip ruby-1.8.7-p358.zip -d /tmp && cd /tmp/ruby-1.8.7-p358 && ./configure && make && sudo make install
now ruby has a new version: patch 358
$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-linux]
and everything works!

Rails using mysql2 instead of sqlite3

I have the following configuration:
linux ubuntu 11.04
rails 3.0.9
ruby 1.9.2p290
mysql2 (0.2.7)
I have created first my project using "rails new"
then I have modified the Gemfile to use mysql2 version 0.2.7 (I have read that later versions are working with rails 3.1 only)
Then I changed the file database.yml to use mysql2 instead of sqlite3
But now I'm getting error ActiveRecord::ConnectionNotEstablished when I try to connect to a Controller. Here are the full logs:
activerecord (3.0.9) lib/active_record/connection_adapters/abstract/connection_pool.rb:317:in `retrieve_connection'
activerecord (3.0.9) lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in `retrieve_connection'
activerecord (3.0.9) lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
activerecord (3.0.9) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.9) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.9) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
activesupport (3.0.9) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
actionpack (3.0.9) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.3) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.9) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.3) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.9) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.3) lib/rack/lock.rb:11:in `call'
rack (1.2.3) lib/rack/lock.rb:11:in `synchronize'
rack (1.2.3) lib/rack/lock.rb:11:in `call'
actionpack (3.0.9) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.9) lib/rails/application.rb:168:in `call'
railties (3.0.9) lib/rails/application.rb:77:in `send'
railties (3.0.9) lib/rails/application.rb:77:in `method_missing'
railties (3.0.9) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.3) lib/rack/content_length.rb:13:in `call'
rack (1.2.3) lib/rack/handler/webrick.rb:52:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.2.3) lib/rack/handler/webrick.rb:13:in `run'
rack (1.2.3) lib/rack/server.rb:217:in `start'
railties (3.0.9) lib/rails/commands/server.rb:65:in `start'
railties (3.0.9) lib/rails/commands.rb:30
railties (3.0.9) lib/rails/commands.rb:27:in `tap'
railties (3.0.9) lib/rails/commands.rb:27
script/rails:6:in `require'
script/rails:6
PS: I tried almost all solutions provided in this website, but I still have the same issue.
I ended by recreating a new project with the command
rails new -d mysql
And now the pages are retrieved without any problem!
I tried to compare the automatic database.yml file and the manual one, the only diffrence I have noticed was on the user used for mysql database. in the new one the username: root is used.
I came back to the old project and I changed to username/password with root ones I now it is working!!!
I would guess that your database.yml file is incorrect. It should look something like this:
development:
adapter: mysql2
host: localhost
username: root
password: xxxx
database: xxxx
If that doesn't work, try changing localhost to 127.0.0.1

Resources