I ran into the error when I tried to run SQL through ruby script. Can someone help me figure out what could be the cause? I already looked for some similar posts but couldn't find the right solution yet.
/Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require': Could not load 'active_record/connection_adapters/redshift_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (LoadError)
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/pg-0.17.1/lib/pg.rb:4:in `<top (required)>'
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activerecord4-redshift-adapter-0.2.1/lib/active_record/connection_adapters/redshift_adapter.rb:17:in `<top (required)>'
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from /Users/User/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in `require'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activerecord-4.2.10/lib/active_record/connection_adapters/connection_specification.rb:175:in `spec'
from /Users/User/.rvm/gems/ruby-2.4.3/gems/activerecord-4.2.10/lib/active_record/connection_handling.rb:50:in `establish_connection'
from /Users/User/Desktop/github/tracker/app/workers/appsflyer_importer_worker_aggregate.rb:100:in `fetch_data'
from /Users/User/Desktop/github/tracker/app/workers/appsflyer_importer_worker_aggregate.rb:120:in `perform'
from -:30:in `<main>'
Here is my settings:
Gemfile
ruby '2.4.3'
gem 'activerecord4-redshift-adapter', '~> 0.2'
gem 'pg'
Ruby version
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin17]
Gem list
activerecord (4.2.10, 4.2.8)
activerecord4-redshift-adapter (0.2.1)
pg (1.0.0, 0.17.1)
Script
require 'active_record'
conn = {
adapter: 'redshift',
database: '#database',
host: '#host',
port: 5439,
username: '#username',
password: '#password'
}
ActiveRecord::Base.establish_connection(conn)
sql = 'select count(*) from table'
ActiveRecord::Base.connection.execute(sql)
You're using the pg gem version 1.0.0 and it is not compatible with the version of active_record and activerecord4-redshift-adapter that you're using:
The PGconn, PGresult, and PGError constants are deprecated, and will be removed as of version 1.0.
This can be seen in the history of the pg gem.
The activerecord4-redshift-adapter uses both the PGconn and PGError constants:
def connection_active?
#connection.status == PGconn::CONNECTION_OK
rescue PGError
false
end
Although I was unable to exactly duplicate the error message that you saw, by modifying the Gemfile to use an older version of the pg gem I was able to get farther along:
gem 'pg', '~> 0.21'
My exact steps were:
create the Gemfile
create a file test.rb containing your Ruby code
run bundle install
run bundle exec ruby test.rb
This produces the following error:
/Users/test/.rvm/gems/ruby-2.4.3/gems/activerecord4-redshift-adapter-0.2.1/lib/active_record/connection_adapters/redshift_adapter.rb:568:in `initialize': could not translate host name "#host" to address: nodename nor servname provided, or not known (PG::ConnectionBad)
This is almost certainly in the right direction for the problem you're having, and should put you on the path to accomplishing your goal.
Related
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
I wasting a day by struggling against that damn error. Hope you'll help me. It happens when I try to launch bundle exec cucumber -r features
Stacktrace:
Could not load 'active_record/connection_adapters/mysql2_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (LoadError)
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/mysql2-0.3.16/lib/mysql2.rb:8:in `<top (required)>'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.1/lib/active_record/connection_adapters/mysql2_adapter.rb:4:in `<top (required)>'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.1/lib/active_record/connection_adapters/connection_specification.rb:188:in `spec'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.1/lib/active_record/connection_handling.rb:50:in `establish_connection'
/Users/volodymyr/projects/conductor/conductor/cucumber/features/support/databases.rb:27:in `<class:ReportingDb>'
/Users/volodymyr/projects/conductor/conductor/cucumber/features/support/databases.rb:11:in `<top (required)>'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/cucumber-1.3.15/lib/cucumber/rb_support/rb_language.rb:95:in `load'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/cucumber-1.3.15/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/cucumber-1.3.15/lib/cucumber/runtime/support_code.rb:180:in `load_file'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/cucumber-1.3.15/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/cucumber-1.3.15/lib/cucumber/runtime/support_code.rb:82:in `each'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/cucumber-1.3.15/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/cucumber-1.3.15/lib/cucumber/runtime.rb:184:in `load_step_definitions'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/cucumber-1.3.15/lib/cucumber/runtime.rb:42:in `run!'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/cucumber-1.3.15/lib/cucumber/cli/main.rb:47:in `execute!'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/gems/cucumber-1.3.15/bin/cucumber:13:in `<top (required)>'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/bin/cucumber:23:in `load'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/bin/cucumber:23:in `<main>'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/Users/volodymyr/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
Gemfile:
source 'http://rubygems.org'
gem 'cucumber'
gem 'rspec'
gem 'watir-webdriver'
gem 'parallel_tests'
gem 'activesupport'
gem 'httparty'
gem 'i18n'
gem 'json'
gem 'logger'
gem 'nokogiri'
gem 'activerecord'
gem 'mysql2', '> 0.3'
gem 'factory_girl'
gem 'database_cleaner'
gem 'aws-sdk'
gem 'rubyzip' # Required for rubyXL
gem 'rubyXL'
gem 'syntax'
gem 'rake'
gem 'mail'
group :development do
gem 'guard-cucumber' # Guard for Cucumber
gem 'terminal-notifier-guard' # OSX notifications! :)
end
You must define the database connection and provide the credentials in a database.yml file in your config folder. If you do not have this file, create it and add our settings to it:
# in config/database.yml
development:
adapter: mysql2
encoding: utf8
database: DATABASE_NAME_FOR_DEVELOPMENT
username: DATABASE_USER
password: DATABASE_PASSWORD
host: localhost
port: 3306
test:
adapter: mysql2
encoding: utf8
database: DATABASE_NAME_FOR_TESTS
username: DATABASE_USER
password: DATABASE_PASSWORD
host: localhost
port: 3306
The problem is the installation, verify your OS and install again. For example, I have Xubuntu 16.04, so i followed this steps.
wget -qO - https://deb.packager.io/key | sudo apt-key add -
echo "deb https://deb.packager.io/gh/opf/openproject-ce xenial stable/6" | sudo tee /etc/apt/sources.list.d/openproject.list
sudo apt-get update
sudo apt-get install openproject
This is the installation guide for all the systems.
I was trying to setup facebook app locally, using ruby and sinatra, in Kubuntu 12.04.
I have included following gems in my gemfile. I have postgresql installed in my system and I am able to run the postgresql command line and run basic commands as createdb, create table etc.
gem "sinatra"
gem "koala"
gem "json", "1.5.5"
gem "httparty"
gem "thin"
gem "rack", "1.3.10"
gem "pg"
gem "activerecord"
gem "sinatra-activerecord"
And in my app.rb file added these files,
require "rubygems"
require "sinatra"
require "sinatra/activerecord"
require "koala"
require "./config/environment" #database configuration
Running
rake -T
in my terminal gives me the following error.
rake aborted!
(<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:39:in `database_file='
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1033:in `set'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:50:in `registered'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1317:in `block in register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1315:in `each'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1315:in `register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1648:in `register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1688:in `register'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:76:in `<module:Sinatra>'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:6:in `<top (required)>'
/home/nitin/facebook_app/guarded-gorge-3234/app.rb:3:in `<top (required)>'
/home/nitin/facebook_app/guarded-gorge-3234/Rakefile:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:589:in `raw_load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:89:in `block in load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:88:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:72:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
Could any one please help. Thank you.
As #iain mentioned, this is due to a parse error in your config/database.yml file.
Check that it is valid syntax, and replace any tabs with spaces.
My step is,
Execute RubyInstaller.exe file
install ruby
installed Path: c:\ruby193
install DevKit
gem install libxml-ruby --platform x86-mswin32-60
make test.rb file
require 'rubygems'
require 'xml'
ruby test.rb
print error msg
Error message:
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
126: The specified module could not be found - C:/Ruby193/lib/ruby/gems/1.9.1/gems/lib
xml-ruby-1.1.3-x86-mswin32-60/lib/libxml_ruby.so (LoadError)
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/libxml-ruby-1.1.3-x86-mswin32-6 0/lib/libxml.rb:9:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/libxml-ruby-1.1.3-x86-mswin32-6 0/lib/xml.rb:11:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from test.rb:2:in `<main>'
i want solution in this problem
plz. help me.
Had similar problem on Windows 7x64 with libxml-ruby 2.3.3 (Ruby 2, 1.9.3 and 1.9.2). As per this solution:
https://github.com/xml4r/libxml-ruby/issues/42#issuecomment-7040881
I managed my problem was also solved. Solution (thanks to the original author):
Locate 'libxml.rb' in libxml-ruby gem folder (something like 'C:\Ruby\Ruby192\lib\ruby\gems\1.9.1\gems\libxml-ruby-2.3.3-x86-mingw32\lib')
Add the following on top of the file:
ENV['PATH'] = ENV['PATH'] + ';' + File.expand_path(File.dirname(__FILE__) + '/libs')
Save and enjoy
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'