Skip to content
This repository has been archived by the owner on Nov 17, 2018. It is now read-only.

Error with Rails 3 and matthuhiggins-foreigner #10

Closed
chadoh opened this issue Sep 5, 2010 · 3 comments
Closed

Error with Rails 3 and matthuhiggins-foreigner #10

chadoh opened this issue Sep 5, 2010 · 3 comments

Comments

@chadoh
Copy link

chadoh commented Sep 5, 2010

I am using Rails 3 and have in my gemfile

gem 'matthuhiggins-foreigner', :require => 'foreigner'
gem 'gravtastic', '~> 2.2.0'

Then when I start my server, I get this error:

$ rails s
/Library/Ruby/Gems/1.8/gems/matthuhiggins-foreigner-0.6.4/lib/foreigner.rb:29:in `on_load': undefined method `config' for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:43:in `run_load_hooks'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/base.rb:1867
from /Library/Ruby/Gems/1.8/gems/gravtastic-2.2.0/lib/gravtastic.rb:89
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:62:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:62:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:51:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:51:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler.rb:112:in `require'
from /Users/chad/Dropbox/Sites/pc/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.0/lib/rails/commands.rb:28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.0/lib/rails/commands.rb:28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.0/lib/rails/commands.rb:27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.0/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6

The offending line in gravtastic-2.2.0/lib/gravtastic.rb is

ActiveRecord::Base.send(:include, Gravtastic) if defined?(ActiveRecord) # :nodoc:

And in Foreigner is

ActiveRecord::Base.configurations = Rails.application.config.database_configuration

I don't know if Gravtastic or Foreigner is to blame here; if I comment out either from my Gemfile, the server starts up just fine. You can go over to mattuhiggin's foreigner to see the similar post that I left there.

I'd happily help fix it, but I'm new to this whole world of rails and I've never written a plugin, so I may need some guidance.

@chrislloyd
Copy link
Owner

Hi, have you made any process with this? On a loose inspection it looks like it would be a Foreigner bug. Gravtastic is purposely as non-intrusive as possible. If Foreigner is replacing ActiveRecord::Base.configurations that might screw things up. Does it work if you swap the order of the gems in your Gemfile?

@chadoh
Copy link
Author

chadoh commented Sep 9, 2010

It didn't work when I switched the order. It was a foreigner bug and it has been fixed! Thanks for checking in.

@chrislloyd
Copy link
Owner

Awesome!

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants