im trying to get started with rails. I have made a rails project and now im trying to start the server but get this.
C:\Users\Home\Documents\Sites\simple_cms>rails server
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.2/mysql2 (LoadError)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:134:in `require'
from C:/Users/Home/Documents/Sites/simple_cms/config/application.rb:7:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
my gemfile has gem 'mysql2', '~> 0.3.18'
windows 7
ruby version 2.2.1
rails 4.2.1
mySql server version 5.6.24
Edit:
Couldn't find a solution that worked for me so i installed a different version of rails and it worked out.
Make sure you have installed mysql2 gem using bundle install and that bundle install has returned successful installation.
#James, This issue has been already raised so follow these links and hope this may help you.
1) Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". On Windows XP with Ruby 2.0.0
2) Ruby on Rails - cannot load such file -- mysql2/2.2/mysql2 (LoadError)
3) https://github.com/bundler/bundler/issues/3456
Try to change
gem 'mysql2', '~> 0.3.18'
to
gem 'mysql2', '~> 0.3.11'
I think that maximum compatible version with Windows is 0.3.11. Then run again bundle install
Related
I'm trying to run the command
thin -R lat.ru start
in the directory 50web\servers\dev (lat.ru is part of the open source project 50web).
I get the following error:
D:\dev\derek\50web\servers\dev>thin -R lat.ru start
C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': ca
nnot load such file -- 2.1/pg_ext (LoadError)
from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/pg-0.18.4/lib/pg.rb:14:in `rescu
e in <top (required)>'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/pg-0.18.4/lib/pg.rb:3:in `<top (
required)>'
from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in
`require'
from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in
`rescue in require'
from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in
`require'
from C:/Ruby21/lib/ruby/site_ruby/2.1.0/getdb.rb:11:in `<top (required)>
'
from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
from D:/dev/derek/50web/routes/lat.rb:2:in `<top (required)>'
from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
from lat.ru:3:in `block in <main>'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:5
5:in `instance_eval'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:5
5:in `initialize'
from lat.ru:1:in `new'
from lat.ru:1:in `<main>'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/rack/adapter/load
er.rb:33:in `eval'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/rack/adapter/load
er.rb:33:in `load'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/thin/controllers/
controller.rb:182:in `load_rackup_config'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/thin/controllers/
controller.rb:72:in `start'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/thin/runner.rb:20
0:in `run_command'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/lib/thin/runner.rb:15
6:in `run!'
from C:/Ruby21/lib/ruby/gems/2.1.0/gems/thin-1.6.4/bin/thin:6:in `<top (
required)>'
from C:/Ruby21/bin/thin:23:in `load'
from C:/Ruby21/bin/thin:23:in `<main>'
I'm using pg 0.18.4, which seems like the most recent version:
D:\dev\derek\50web\servers\dev>gem list pg
*** LOCAL GEMS ***
pg (0.18.4)
D:\dev\derek\50web\servers\dev>gem update pg
Updating installed gems
Nothing to update
Ruby version is 2.1.7p400 (2015-08-18 revision 51632) [i386-mingw32].
How can I fix this error?
Update 1 (02.02.2016 08:08 MSK):
I've to run the same project on a different machine:
C:\usr\dp\dev\derek\50web\servers\dev>ruby lat.ru
C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- 2.2/pg_ext (LoadError)
from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/pg-0.18.4/lib/pg.rb:14:in `rescue in <top (required)>'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/pg-0.18.4/lib/pg.rb:3:in `<top (required)>'
from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
I noticed that Ruby seems to look for the pg_ext file in 2.2/pg_ext directory, whereas in reality it's installed in the C:\Ruby22\lib\ruby\gems\2.2.0\gems\pg-0.18.4\lib directory.
It looks like installation of C-extension part of pg gem is broken.
make sure postgresql development libraries are installed
reinstall pg gem and see if there are no error messages
Reinstallation with -f force flag, or better gem uninstall and gem install anew.
I fixed the error by uninstalling the pg gem and re-installing it using gem install pg --pre command. It's necessary because of a bug, which hasn't been fixed in the release version yet.
I have installed ruby 2.1.1 using rvm after root login. In another user login ruby 1.8.7 is in use. with 1.8.7 Redmine 2.5.0 works fine. but with 2.1.0
command:
ruby script/rails server webrick -d -e production
error:
/usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:252:in `require': /usr/local/rvm/gems/ruby-2.1.1/gems/vpim-0.695/lib/vpim/vcard.rb:679: invalid multibyte escape: /^\xFE\xFF/ (SyntaxError)
invalid multibyte escape: /^\xFF\xFE/
from /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:252:in `block in require'
from /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:237:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.1.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:252:in `require'
from /usr/local/rvm/gems/ruby-2.1.1/gems/vpim-0.695/lib/vpim.rb:12:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
from /usr/local/rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
from /home/dax/redmine-2.5.0/config/application.rb:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-3.2.17/lib/rails/commands.rb:53:in `require'
from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-3.2.17/lib/rails/commands.rb:53:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-3.2.17/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-3.2.17/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Try to remove the gem vpim with this command:
gem uninstall vpim
I've tried an installation and don't need this gem.
If you really need that gem edit the file
/usr/local/rvm/gems/ruby-2.1.1/gems/vpim-0.695/lib/vpim/vcard.rb
and place this in the first line:
# encoding: US-ASCII
The vpim gem mentioned in your stack trace is not a requirement of core Redmine. It seems you have a custom plugin which requires that gem and which is not compatible with newer Ruby versions (i.e. anything >= 1.9).
To solve this issue, you thus need to update or remove that custom plugin. Also, right now, it is probably a good idea to not use Ruby 2.1 but Ruby 2.0 as it seems that Redmine core (or more generally, Rails 3.2) still has other issues with Ruby 2.1.1.
I thought I had Compass installed OK using rbenv on my Mac, but I got an error when trying to switch Codekit to use it instead of its internal compiler.
Running compass -v in the terminal gives me:
/.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `require': cannot load such file -- sass/script/node (LoadError)
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:35:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches/browser_support.rb:1:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:2:in `block in <top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `each'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass/sass_extensions.rb:9:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass.rb:5:in `block in <top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass.rb:4:in `each'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/lib/compass.rb:4:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:58:in `require'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/bin/compass:20:in `block in <top (required)>'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/bin/compass:8:in `fallback_load_path'
from /.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/compass-0.12.2/bin/compass:19:in `<top (required)>'
from /.rbenv/versions/1.9.3-p392/bin/compass:23:in `load'
from /.rbenv/versions/1.9.3-p392/bin/compass:23:in `<main>'
So, it would seem there's a problem there, although running gem install compass tells me that compass-0.12.2 was successfully installed.
How do I go about working out what the problem is and fixing it?
Try this version,
http://rubygems.org/gems/sass/versions/3.3.0.alpha.149
gem install sass -v 3.3.0.alpha.149 --pre
Bear in mind that the command above installs the gem, it doesn't activate the version!
You can run the following:
gem uninstall sass
You'll be prompted with a list of installed versions; merely uninstall the ones that are 3.3.0.alpha.X where X is higher then 149.
You can test it works via:
sass --version
compass --version
You should see normal pages (instead of the errors in your question).
ps.
You may need this too:
gem install compass-sourcemaps -v 0.12.2.sourcemaps.57a186c --pre
In my case, it was an incompatibility between compass and sass. It was "sass-3.3.0.rc.2" installed automatically via compass dependencies.
So I had to remove sass version gem uninstall sass and install another version gem install sass -v 3.2.12
After that, the errors disappeared.
There's an issue with some imports in one script within compass. An easy fix, but for now you can add this to your Gemfile (works for me right now):
gem "compass", github: 'ovaskevich/compass'
I tried to getting started with chef so I installed the chef gem on my laptop ( OS : OSX 10.8) with ruby 2.0.0-p0 but when I try to "knife configure " I juste get this message :
/Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:106:in `require': cannot load such file -- rubygems/format (LoadError)
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:106:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/provider/package/rubygems.rb:34:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/providers.rb:60:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef.rb:25:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chefspec-0.9.0/lib/chefspec.rb:1:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chefspec-0.9.0/lib/chef/knife/cookbook_create_specs.rb:1:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife/core/subcommand_loader.rb:37:in `load'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife/core/subcommand_loader.rb:37:in `block in load_commands'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife/core/subcommand_loader.rb:37:in `each'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife/core/subcommand_loader.rb:37:in `load_commands'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife.rb:119:in `load_commands'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/knife.rb:167:in `run'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/lib/chef/application/knife.rb:123:in `run'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/chef-11.4.0/bin/knife:25:in `<top (required)>'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/bin/knife:23:in `load'
from /Users/maximeheckel/.rbenv/versions/2.0.0-p0/bin/knife:23:in `<main>'
The accepted answer isn't entirely correct. The problem isn't ruby 2.0, it's rubygems 2.x. If you run gem update --system 1.8.25 to downgrade to a pre 2.x rubygems, everything works like a champ.
NOTE: I haven't had to do this locally, but this is how I've gotten knife bootstrap to work against my remote servers. I'm running ruby 2.0 on my local machine with latest rubygems and chef 11.4.4 and everything else seems to work properly.
According to this issue at opscode it was a bug. It has been fixed in chef 11.6.0.
The problem is that only chef 11.4.4 is on rubygems as of today (2013-06-23)
So, either use 1.9.x or rubygems 1.8.25 will work for now, until the next version of chef comes out. It may be possible to build it from https://github.com/opscode/chef.git
I ended up patching my chef 11.4.4 lib/chef/provider/package/rubygems.rb with this file: https://github.com/opscode/chef/blob/d6748efde62502ab6f5d97052f46ca00352497ef/lib/chef/provider/package/rubygems.rb
I had similar errors trying to use Chef (10.24 and 11.4) with Ruby 2.0 - so I assume Chef is not yet Ruby 2.0 compatible :(
The accepted answer is great if you're using the system ruby (/usr/bin/ruby, for example), but it didn't work for me because I'm using RVM. I found an equivalent solution in case you're using RVM:
rvm rubygems 1.8.25 will install rubygems version 1.8.25 for your RVM ruby.
I added the composite_primary_keys gem in my Gemfile. On local environment it runs fine, but on a centos machine it breaks with the following error. Ruby version is 1.9.2p290 and rubygems version is 1.3.7 on both environments. Does anyone know why that could be?
bundle exec rake db:create --trace
no such file to load -- active_record/associations/has_and_belongs_to_many_association
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/var/tmp/jenkins/gem_cache/myapp/gems/composite_primary_keys-4.1.2/lib/composite_primary_keys.rb:40:in `<top (required)>'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `block in require'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler.rb:122:in `require'
The same error can occur when trying to use the composite_primary_keys gem with Active Record 4.1.0:
.../vendor/cache/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require': cannot load such file -- active_record/associations/has_and_belongs_to_many_association (LoadError)
from .../vendor/cache/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `block in require'
from .../vendor/cache/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
...
This is because the current release of composite_primary_keys (version 6.0.1 as of 17 April 2014) doesn't include support for Active Record 4.1.0, which apparently removed the file in question.
The problem is fixed in the ar_4.1.x branch of the gem's source code, however. If your project uses Bundler, a solution is to edit its Gemfile and replace the line
gem 'composite_primary_keys'
with
gem 'composite_primary_keys', {
:git => 'git://github.com/composite-primary-keys/composite_primary_keys.git',
:branch => 'ar_4.1.x'
}
then run bundle install from your project's root folder.
Cleaning the shared gems list on the jenkins machine fixed the issue.
Update your Gemfile:
gem 'composite_primary_keys', '~> 7.0'