You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/app/vendor/bundler_gems/gems/foreigner-0.9.0/lib/foreigner.rb:32:in `configured_adapter':NoMethodError: undefined method `spec' for nil:NilClass
I think the load_adapter! call is happening too early. Obviously for 2.x we're skipping the Railtie block and immediately loading the adapter. Perhaps the problem is that I'm using bundler and not config.gem so the gem is being required before rails is fully initialized.
Manually calling Foreigner.load_adapter! in a config.after_initialize block in the environment.rb works fine provided I force the gem to only call that method if ActiveRecord::Base.connection_pool is available.
Quick fix would be to add this to the Rails 2 loading of foreigner and leaving it up to the developers to manually call this after_initialize unless you know of a way to set it up to happen after initialize once we know the pool isn't available.
Foreigner.load_adapter! if ActiveRecord::Base.connection_pool
The text was updated successfully, but these errors were encountered:
Are you guys only seeing this with the combo of Rails 2.X and Bundler? I've had a pain supporting both rails 2 and 3 at the same time, and maybe should have just created a Rails 2 branch for those who haven't upgraded.
In my case it was Rails 2.x and Bundler. I'm actually not in that position anymore and the codebase eventually moved to Rails 3.x so I'm not able to do much more in the way of troubleshooting.
I'm pretty certain the reliance on the railtie after_intialize is the cause here.
Looks like same problem mentioned here: http://github.com/matthuhiggins/foreigner/issues/closed#issue/13
I think the load_adapter! call is happening too early. Obviously for 2.x we're skipping the Railtie block and immediately loading the adapter. Perhaps the problem is that I'm using bundler and not config.gem so the gem is being required before rails is fully initialized.
Manually calling Foreigner.load_adapter! in a config.after_initialize block in the environment.rb works fine provided I force the gem to only call that method if ActiveRecord::Base.connection_pool is available.
Quick fix would be to add this to the Rails 2 loading of foreigner and leaving it up to the developers to manually call this after_initialize unless you know of a way to set it up to happen after initialize once we know the pool isn't available.
The text was updated successfully, but these errors were encountered: