Why am I getting an error requiring this stone in environment.rb?

I followed the steps here and set the compos_primary_keys gem. When I try to require a stone in environment.rb at the very bottom of the file (after "end") through

require 'composite_primary_keys'

I get this when the server starts

"69125"
=> Booting Mongrel
=> Rails 2.3.4 application starting on http://127.0.0.1:3002
/Library/Ruby/Site/1.8/rubygems.rb:270:in `activate': You have a nil object when you didn't expect it! (NoMethodError)
You might have expected an instance of Array.
The error occurred while evaluating nil.map
 from /Library/Ruby/Site/1.8/rubygems.rb:296:in `activate'
 from /Library/Ruby/Site/1.8/rubygems.rb:295:in `each'
 from /Library/Ruby/Site/1.8/rubygems.rb:295:in `activate'
 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:35:in `require'
 from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
 from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
 from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
 from /path/to/www/config/environment.rb:54
 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
 from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
 from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
 from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
 from /path/to/www/vendor/rails/railties/lib/commands/server.rb:84
 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
 from ./script/server:3
 from -e:2:in `load'
 from -e:2

Any idea why this is happening?

+1
source share
1 answer

Try placing it in environment.rb as follows:

Rails::Initializer.run do |config|

  config.gem 'composite_primary_keys'

end
+3
source

Source: https://habr.com/ru/post/1735638/


All Articles