Error after upgrade from rails 3.1 to 3.2.6 - ruby-on-rails

I set myself the task of upgrading my app from rails 3.1 to rails 3.2.6 on my local mac book air lion dev environment. I followed this guide and ruby is upgraded, and all of my gems seemed to install and rails -v gives the answer of rails 3.2.6. If I run any rails commands though, e.g. rails c to start the console, I get this:
MacBook-Air:myapp bob$ rails c
/Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1:in `require': cannot load such file -- ./pubnub.rb (LoadError)
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1:in `<top (required)>'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /Users/bob/work/myapp/config/application.rb:13:in `<top (required)>'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/railties-3.2.6/lib/rails/commands.rb:39:in `require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/railties-3.2.6/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Yes I do use pubnub in my app - it's always been working fine so I don't suspect it necessarily is the problem.
The application.rb line 13 (might be not be relevant) is
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
I do precompile assets before deploying.
The /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1 file is present and I opened it fine.
Does anyone know whats going on / is it pubnub specific or something else? I'm not sure how to troubleshoot further and googling hasn't brought anything up so far.
Thanks,
Dave

I don't see the file pubnub-ruby.rb in the repo for that gem. Try running $ bundle install or $ gem update pubnub-ruby.

Related

uninitialized constant I18n::JS Ruby on Rails

I am still having trouble with Ruby on Rails. I run rails s (this is for my openproject app) and I get this (before it was working). I also wanted to make a note I am now using Ruby 2.0 and I still get the same error.
require 'rails/all'... 0.850s
Bundler.require... 7.700s
/home/bistro/openproject/config/application.rb:89:in `<class:Application>': uninitialized constant I18n::JS (NameError)
from /home/bistro/openproject/config/application.rb:61:in `<module:OpenProject>'
from /home/bistro/openproject/config/application.rb:60:in `<top (required)>'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:53:in `require'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:53:in `block in <top (required)>'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:50:in `tap'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I'm working on a Rails Ember app and I had exactly the same problem, trying to internationalize the client-side using the i18n-js gem (https://github.com/fnando/i18n-js). To give more context, I am following the instructions in this article: http://eviltrout.com/2013/11/24/i18n-in-ember.html
In my case, Rails did not find I18n::JS because it is now called SimplesIdeias::I18n (you can see it by running rake middleware from the command line). Adding the line
config.middleware.use SimplesIdeias::I18n::Middleware
in the application.rb file solved the problem for me, hope it helps.
If you happen upon this now adays. your gemfile should say something like gem 'i18n-js', ">= 3.0.0.rc11". Otherwise you will end up using version 2.0

Trying to deploy a Rails 4 app to WebFaction, using their documentation and getting an error locally

I am trying to deploy a Rails 4 app via github to Webfaction via Capistrano 2.15.5. Initially I installed Capistrano 3 and was getting errors, so I ended up installing Capistrano 2.15.5 and following webfaction's documentation here:
I spoke with webfaction, and they suggested I try the older Cap 2 version since that's what they're familiar with and wouldn't be updating their documentation for Capistrano 3 for awhile.
I get through all the appropriate steps in their tutorial, and I get a bunch of errors when trying to run "cap deploy:setup" or "cap deploy:check" etc.
Errors in a pastebin, here: (and shown below)
/Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require': cannot load such file -- capistrano/setup (LoadError)
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require'
from Capfile:6:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:180:in `load_from_file'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:89:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `block in load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `each'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `each'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `load_recipes'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:31:in `execute!'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
galactica% cap deploy:check
/Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require': cannot load such file -- capistrano/setup (LoadError)
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require'
from Capfile:6:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:180:in `load_from_file'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:89:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `block in load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `each'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `each'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `load_recipes'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:31:in `execute!'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
I've tried looking into the files, but I'm unsure really of what the issue is, and I dont know enough ruby to troubleshoot. I was hoping you of you could help me.
Any help would be IMMENSELY appreciated and gittipp'ed!! :)
Thank you in advance!
~Josh
I'm guessing you set up your project's configuration with Capistrano 3, and I think the setup for Capistrano 2 is different.
I'm not too familiar with the differences, but the error you're getting is cannot load such file -- capistrano/setup and this post about capistrano 3 references require 'capistrano/setup' as being in the Capfile that capistrano 3 generates.
So I'm guessing that file doesn't exist for capistrano 2. I don't know if capistrano 2 has generators that you could run and let them overwrite the files you have, but if it does, try that?
Or try taking out that line and see if you get a different error? Or revert the commit(s) where you started setting up capistrano 3 and start the configuration process completely over with capistrano 2?
Have you installed Capistrano 2 using "gem install" under your ruby v2.0?
rvm 2.0.0
gem install capistrano "your version"
Try this first....
I got the same error while deploying my rails 4 application using cap 2.15.5. I did research and found out that the problem was syntax as i switched from cap 3 to cap 2. So if you are using cap v2 only load command work in capfile and Require commands are used only in deploy.rb . So if you are switching from 3 to 2, do keep in mind the syntax as there are lots of changes between cap v2 and cap v3.
Note: For deploying rails 4 application 2.15.5 is the stable capistrano version you can use. Here is the guide link that worked for me : https://gist.github.com/brobertsaz/8660415

sunspot_solr error on heroku?

I'm using 'sunspot_rails', '~> 2.0.0.pre.120415' for Solr search in my rails app and deploy it on heroku (two separate application).
It's working fine on one application but throw error on other.
I have checked the heroku environment and found that -
one app is on cedar stack and ruby version is 1.9.2p290. (Working fine)
other one is on bamboo stack and ruby version is 1.9.2p180 (throw error)
So, Is this the ruby version problem or heroku stack problem ?
Ruby version on development environment is 1.9.2p290.
Error
$ heroku run rake sunspot:reindex
Running rake sunspot:reindex attached to terminal... up, run.8567
rake aborted!
uninitialized constant Sunspot::Adapters::Registry::Forwardable
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:310:in `<class:Registry>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:309:in `<module:Adapters>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:34:in `<module:Sunspot>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:1:in `<top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot.rb:18:in `block in <top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot.rb:15:in `each'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot.rb:15:in `<top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot_rails-2.0.0.pre.120925/lib/sunspot/rails.rb:1:in `<top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot_rails-2.0.0.pre.120925/lib/sunspot_rails.rb:6:in `<top (required)>'
/app/config/application.rb:7:in `<top (required)>'
/app/Rakefile:4:in `require'
/app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
To be even more clear, at the top of adapters.rb (sunspot/lib/sunspot/adapters.rb), add the following line:
require 'forwardable'
module Sunspot
#
# Sunspot works by saving references to the primary key (or natural ID) of
I have found the solution.
Actually it's a environment problem on heroku.On local system the ruby version is ruby 1.9.2p290 and on heroku is ruby 1.9.2p180. Ruby 1.9.2p180 doesn't include 'Forwardable' module. So I just need to include 'Forwardable' module in my application.

Netbeans Ruby/Rails project, Can't run, Bundler output window blank empty

I setup a new rail application in Netbeans 7.1. Without writing any code, I wanted to see if it just runs but
When clicking run I get errors:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': 126: The specified module could not be found. - C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so (LoadError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `block in require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler.rb:119:in `require'
from C:/_PROJECTS/active/Callisto2.0/config/application.rb:7:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:53:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:53:in `block in <top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I've installed a few gems it was complaining about through netbeans gem manager but I got stuck at mysql2. Even though I installed mysql and mysql2 gems, it still won't find it.
With little research, it seems i have to do a bundle install, for WEBrick to run/ check dependencies or whatever. Netbeans project has a Bundler context menu with options for check, init, install, show etc.
None of those produce any output in the Output: Bundler window. The Bundler process starts in netbeans processes but then quits after a second. No errors, info or anything.
What do I need to do to get this working. This is a blank Ruby/Rails Application through Netbeans 7.1.
EDIT 1:
The error in file: C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2 contains the following lines:
RUBY_VERSION =~ /(\d+.\d+)/
require "mysql2/#{$1}/mysql2"
Nothing Special. I tried changing that to mysql, or just "mysql2", it doesn't work. Errors that client is not initialized when I comment the whole line.
Netbeans stopped supporting rails. See :
Ruby Dropped in Netbeans 7,How to Use it in Netbeans7?
And:
http://noteslog.com/post/netbeans-6-9-1-ruby-1-9-2-rails-3-0-0-mysql-gem-2-8-1/
Did you get a message that your user is not allowed to install gems?
Then you should try following command in your rails application root folder
bundle install --path vendor/bundle
make sure to have the configurated database.yml in the config folder before running the previous command, or run it again after creating the file.

problem installing webrick / mogrel or any other server for Rails 3

I have tried various installation methods for deploying a WEBrick and mongrel from the terminal. When I enter the rails server command I get the following:
Toran1$ rails server
/Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.2/lib/mysql2.rb:8:in `require': dlopen(/Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/mysql2-0.3.2/lib/mysql2.rb:8:in `<top (required)>'
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `each'
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `block in require'
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `each'
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `require'
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.13/lib/bundler.rb:120:in `require'
from /Users/Toran1/Sites/simple_cms/config/application.rb:7:in `<top (required)>'
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.7/lib/rails/commands.rb:28:in `require'
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.7/lib/rails/commands.rb:28:in `block in <top (required)>'
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
from /Users/Toran1/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.7/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have installed the gem both locally and at the root level, and I also have navigated to the application folder before issuing the command. Any help would be appreciated!
Webrick will install automatically if you install rails in a correct manner.
Try this link
Here
And if you don't want to install rails again, try to install server using gem command
Dont forget to include the gems in Gemfile and to run "bundle install"
If you are using Rails < 3.1 you need to use version ~> 0.2.7 of the mysql2 gem
Checkout the documentation and search for active record: https://github.com/brianmario/mysql2
I'm not sure if that will help solve this problem directly, but it may solve others that you may encounter.
Just update your bundler, maybe of any-one of the older gem is conflicting with latest one, this type of issues arises.
gem install bundler
and then bundler install
If you find again error, then delete GEM.lock file, then run
bundler install
This may resolve the issue.

Resources