Closed rdvdijk closed 4 years ago
That's interesting. By the looks of the error message ActiveSupport
isn't available (which is correct per your gemfile
). It first looks in the global namespace then looks off the current class, that's why it's trying for ActiveRecord::Acts::List::ScopeMethodDefiner::ActiveSupport
which doesn't exist.
Try including ActiveSupport and see how you get on. I guess since we're now using ActiveSupport we should add that as a dependency.
Actually ActiveSupport
is required by by ActiveRecord
so it's strange that it's not being installed when you bundle. Can you confirm if it's installed or not?
It is installed. The only way to make this work is changing the Gemfile
to:
source "https://rubygems.org"
gem "activerecord"
gem "acts_as_list", require: false
Adding gem "activesupport"
to the Gemfile
as you suggested I also did try earlier, but did not work.
Sounds like it's something to do with the require order then :) If you manage to figure it out let me know :) We have had problems like this in the past, so it's worth checking through the old Issues and PR's. It's certainly a strange one.
Did some initial Bundler debugging, in the require
method mentioned in the backtrace:
/home/username/.gem/ruby/2.7.1/gems/bundler-2.1.4/lib/bundler/runtime.rb:74:in `require'
Using this Gemfile:
source "https://rubygems.org"
gem "activerecord"
gem "activesupport"
gem "acts_as_list"
I see that the activerecord
, activesupport
and acts_as_list
gems are loaded in that order, so activesupport
is indeed required before acts_as_list
is loaded. But still the exception occurs. Does ActiveSupport somehow not actually create ActiveSupport
in the global namespace?
One fix I could come up with is adding a require
to lib/acts_as_list/active_record/acts/scope_method_definer.rb
:
# frozen_string_literal: true
require 'active_support/inflector'
module ActiveRecord::Acts::List::ScopeMethodDefiner #:nodoc:
extend ActiveSupport::Inflector
Would that be an acceptable fix? If so, I can open a pull request for this.
Thanks for that @rdvdijk. That seems like a reasonable solution :)
Using this minimal
Gemfile
, thebundle console
command fails:Running:
Results in a large Bundler error message, the backtrace section shows:
As the backtrace shows, this is using Ruby 2.7.1, Bundler 2.1.4 and
acts_as_list
1.0.2. I've tried older versions of ActiveRecord and Bundler, butbundle console
always fails.