pinnymz / migration_comments

Comments for your migrations
MIT License
174 stars 31 forks source link

undefined method `descendants' for MigrationComments::ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation:Module (NoMethodError) #43

Open YanKyawMinGIT opened 2 years ago

YanKyawMinGIT commented 2 years ago

After rails server , My current Problem is

user@user-MACPC repo % rails server
/Users/user/.gem/ruby/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:26:in `block in setup': undefined method `descendants' for MigrationComments::ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation:Module (NoMethodError)
        from /Users/user/.gem/ruby/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:23:in `each'
        from /Users/user/.gem/ruby/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:23:in `setup'
        from /Users/user/.gem/ruby/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:59:in `<top (required)>'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:60:in `require'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:55:in `each'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:55:in `block in require'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:44:in `each'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler/runtime.rb:44:in `require'
        from /Users/user/.gem/ruby/3.1.0/gems/bundler-2.3.6/lib/bundler.rb:176:in `require'
        from /Users/user/repos/project/repo/config/application.rb:7:in `<top (required)>'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/commands/server/server_command.rb:137:in `require'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/commands/server/server_command.rb:137:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/commands/server/server_command.rb:134:in `perform'
        from /Users/user/.gem/ruby/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        from /Users/user/.gem/ruby/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/user/.gem/ruby/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/command/base.rb:87:in `perform'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/command.rb:48:in `invoke'
        from /Users/user/.gem/ruby/3.1.0/gems/railties-7.0.1/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

Other config :

user@user-MACPC project % ruby -v
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-darwin19]
user@user-MACPC project % rails -v
Rails 7.0.1

user@user-MACPC project % gem list

*** LOCAL GEMS ***

abbrev (default: 0.1.0)
actioncable (7.0.1)
actionmailbox (7.0.1)
actionmailer (7.0.1, 4.0.8)
actionpack (7.0.1, 4.0.8)
actiontext (7.0.1)
actionview (7.0.1)
active_scaffold (3.6.0, 3.5.5)
activejob (7.0.1)
activemodel (7.0.1, 4.0.8)
activerecord (7.0.1, 4.0.8)
activerecord-deprecated_finders (1.0.4)
activerecord-session_store (2.0.0, 1.1.3)
activestorage (7.0.1)
activesupport (7.0.1, 6.1.4.4, 4.0.8)
addressable (2.8.0)
airbrussh (1.4.0)
akami (1.3.1)
arel (4.0.2)
autoprefixer-rails (10.4.2.0)
base64 (default: 0.1.0)
bcrypt (3.1.16)
benchmark (default: 0.1.1)
bigdecimal (default: 3.0.0)
bootstrap-sass (3.4.1)
builder (3.2.4, 3.1.4)
bundler (2.3.6, default: 2.2.32, 1.17.3)
capistrano (3.16.0)
capistrano-bundler (2.0.1, 1.6.0)
capistrano-passenger (0.2.1)
capistrano-rails (1.6.1, 1.1.8)
capistrano-rbenv (2.2.0)
cgi (default: 0.2.1)
coderay (1.1.3)
coffee-rails (5.0.0, 4.0.1)
coffee-script (2.4.1)
coffee-script-source (1.12.2)
concurrent-ruby (1.1.9)
coveralls (0.8.23)
cow_proxy (0.3.3)
crack (0.4.5)
crass (1.0.6)
csv (default: 3.1.9)
date (default: 3.1.3)
dbm (default: 1.1.0)
debase (0.2.5.beta2)
debase-ruby_core_source (0.10.14)
debug (1.4.0, default: 0.2.1)
delegate (default: 0.2.0)
devise (4.8.1)
did_you_mean (default: 1.5.0)
diff-lcs (1.5.0)
digest (3.1.0, default: 3.0.0)
docile (1.4.0)
double-bag-ftps (0.1.4)
drb (default: 2.0.5)
english (default: 0.7.1)
erb (default: 2.2.0)
erubi (1.10.0)
erubis (2.7.0)
etc (default: 1.3.0)
excon (0.90.0)
execjs (2.8.1)
faraday (2.1.0, 1.9.3)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
faraday-net_http (2.0.1, 1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
fcntl (default: 1.0.1)
ffi (1.15.5)
fiddle (default: 1.0.8)
fileutils (default: 1.5.0)
find (default: 0.1.0)
formatador (1.1.0)
forwardable (default: 1.3.2)
getoptlong (default: 0.1.1)
globalid (1.0.0)
guard (2.18.0)
guard-compat (1.2.1)
guard-rspec (4.7.3)
gyoku (1.3.1)
hashdiff (1.0.1)
hashie (5.0.0, 3.6.0)
hike (1.2.3)
httpclient (2.8.3)
httpi (2.5.0)
i18n (1.9.0, 0.9.5)
ice_nine (0.11.2)
image_size (3.0.1)
io-console (default: 0.5.7)
io-nonblock (default: 0.1.0)
io-wait (0.2.1, default: 0.2.0)
ipaddr (default: 1.2.2)
irb (default: 1.3.5)
jbuilder (2.11.5, 1.5.3)
jeff (1.5.2)
jquery-rails (4.4.0, 3.1.5)
json (2.6.1, default: 2.5.1)
jwt (2.3.0)
libv8 (3.16.14.19)
listen (3.7.1)
logger (default: 1.4.3)
loofah (2.13.0)
lumberjack (1.2.8)
mail (2.7.1, 2.5.5)
marcel (1.0.2)
matrix (0.4.2, default: 0.3.1)
method_source (1.0.0)
migration_comments (0.4.1, 0.3.2)
mime-types (1.25.1)
mini_mime (1.1.2)
mini_portile2 (2.7.1)
minitest (5.15.0, 4.7.5)
multi_json (1.15.0)
multi_xml (0.5.5)
multipart-post (2.1.1)
mutex_m (default: 0.1.1)
nenv (0.3.0)
net-ftp (0.1.3, default: 0.1.2)
net-http (default: 0.1.1)
net-imap (0.2.3, 0.2.2, default: 0.1.1)
net-pop (0.1.1)
net-protocol (0.1.2, default: 0.1.1)
net-scp (3.0.0)
net-smtp (0.3.1, default: 0.2.1)
net-ssh (6.1.0)
nio4r (2.5.8)
nkf (default: 0.1.0)
nokogiri (1.13.1 x86_64-darwin)
nori (2.6.0)
notiffany (0.1.3)
oauth2 (1.4.7)
observer (default: 0.1.1)
omniauth (2.0.4, 1.4.2)
omniauth-oauth2 (1.7.2, 1.5.0)
omniauth-yconnect (0.0.4.1)
open-uri (default: 0.1.0)
open3 (default: 0.1.1)
openssl (default: 2.2.1)
optparse (default: 0.1.1)
orm_adapter (0.5.0)
ostruct (default: 0.3.1)
pathname (default: 0.1.0)
polyglot (0.3.5)
power_assert (2.0.1)
pp (default: 0.2.1)
prettyprint (default: 0.1.1)
prime (0.1.2)
pry (0.14.1)
pstore (default: 0.1.1)
psych (default: 3.3.2)
public_suffix (4.0.6)
racc (1.6.0, default: 1.5.2)
rack (2.2.3, 1.5.5)
rack-protection (2.1.0)
rack-test (1.1.0, 0.6.3)
rails (7.0.1, 4.0.8)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.4.2)
railties (7.0.1, 4.0.8)
rake (13.0.6, 10.5.0)
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
rbs (2.0.0)
rdoc (6.3.3)
readline (default: 0.0.2)
readline-ext (default: 0.1.1)
ref (2.0.0)
reline (default: 0.2.5)
request_store (1.5.1)
resolv (default: 0.2.1)
resolv-replace (default: 0.1.0)
responders (3.0.1)
rexml (3.2.5)
rinda (default: 0.1.1)
rspec (3.10.0)
rspec-core (3.10.1)
rspec-expectations (3.10.2)
rspec-mocks (3.10.2)
rspec-support (3.10.3)
rss (0.2.9)
ruby-debug-ide (0.7.3)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
sass (3.2.19)
sass-rails (6.0.0, 4.0.5)
sassc (2.4.0)
sassc-rails (2.1.2)
savon (2.12.1)
sdoc (2.3.0)
securerandom (default: 0.1.0)
set (default: 1.0.1)
shellany (0.0.1)
shellwords (default: 0.1.0)
simplecov (0.16.1)
simplecov-html (0.10.2)
singleton (default: 0.1.1)
socksify (1.7.1)
sprockets (4.0.2, 3.7.2, 2.12.5)
sprockets-rails (3.4.2, 2.3.3)
sshkit (1.21.2)
stringio (default: 3.0.1)
strscan (3.0.1)
sync (0.5.0)
syslog (default: 0.1.0)
tempfile (default: 0.1.1)
term-ansicolor (1.7.1)
test-unit (3.5.3)
thor (1.2.1)
thread_safe (0.3.6)
tilt (2.0.10, 1.4.1)
time (default: 0.1.0)
timeout (0.2.0, default: 0.1.1)
tins (1.31.0)
tmpdir (default: 0.1.2)
tracer (default: 0.1.1)
treetop (1.4.15)
tsort (default: 0.1.0)
turbolinks (5.2.1)
turbolinks-source (5.2.0)
typeprof (0.21.1)
tzinfo (2.0.4, 0.3.60)
uglifier (4.2.0)
un (default: 0.1.0)
uri (default: 0.10.1)
warden (1.2.9)
wasabi (3.7.0)
weakref (default: 0.1.1)
webmock (3.14.0)
websocket-driver (0.7.5)
websocket-extensions (0.1.5)
yaml (default: 0.1.1)
zeitwerk (2.5.3)
zlib (default: 2.0.0)

user@user-MACPC project % gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.2.32
  - RUBY VERSION: 3.0.3 (2021-11-24 patchlevel 157) [x86_64-darwin19]
  - INSTALLATION DIRECTORY: /Users/user/.gem/ruby/3.1.0
  - USER INSTALLATION DIRECTORY: /Users/user/.gem/ruby/3.0.0
  - RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /Users/user/.gem/ruby/3.1.0/bin
  - SPEC CACHE DIRECTORY: /Users/user/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/3.0.3/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-darwin-19
  - GEM PATHS:
     - /Users/user/.gem/ruby/3.1.0
     - /Users/user/.rubies/ruby-3.1.0/lib/ruby/gems/3.1.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/user/.gem/ruby/3.1.0/bin
     - /usr/local/opt/ruby/bin
     - /usr/local/opt/php@7.3/sbin
     - /usr/local/opt/php@7.3/bin
     - /Users/user/.pyenv/shims
     - /Users/user/.pyenv/bin
     - /Users/user/.nodebrew/current/bin
     - /opt/local/bin
     - /opt/local/sbin
     - /Users/user/.nodebrew/current/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Library/Apple/usr/bin
     - /Users/user/.gem/ruby/3.1.0/bin
     - /Users/user/.rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/bin
     - /Users/user/.rubies/ruby-3.1.0/bin
     - /usr/local/sbin
     - /usr/local/opt/php@7.3/sbin
     - /usr/local/opt/php@7.3/bin
     - /Users/user/.pyenv/shims
     - /Users/user/.pyenv/bin
     - /Users/user/.nodebrew/current/bin
     - /opt/local/bin
     - /opt/local/sbin
     - /Applications/Visual Studio Code.app/Contents/Resources/app/bin
     - /Users/user/go/bin
     - /usr/local/opt/go/libexec/bin
     - /Applications/Visual Studio Code.app/Contents/Resources/app/bin
     - /Users/user/go/bin
     - /usr/local/opt/go/libexec/bin

How to fix it. I have nothing ideas. pls.

ChrisGambrell commented 2 years ago

I am having this same issue. Thought it might be an issue with my project.

  1. Created a new rails project rails new foobar
  2. Ran rails serve and everything ran fine
  3. Added the migration_comments gem to the Gemfile
  4. Ran bundle install
  5. Ran rails serve and got the same error message below
chris@Chriss-MBP jsx-testing % rails s
/Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:26:in `block in setup': undefined method `descendants' for MigrationComments::ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation:Module (NoMethodError)

      unless ar_class.descendants.include?(mc_class)
                     ^^^^^^^^^^^^
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:23:in `each'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:23:in `setup'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/migration_comments-0.4.1/lib/migration_comments.rb:59:in `<main>'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:60:in `block (2 levels) in require'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:55:in `each'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:55:in `block in require'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:44:in `each'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:44:in `require'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler.rb:176:in `require'
    from /Users/chris/Desktop/jsx-testing/config/application.rb:7:in `<main>'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/commands/server/server_command.rb:137:in `block in perform'
    from <internal:kernel>:90:in `tap'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/commands/server/server_command.rb:134:in `perform'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/command/base.rb:87:in `perform'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/command.rb:48:in `invoke'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.3/lib/rails/commands.rb:18:in `<main>'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from /Users/chris/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    from bin/rails:4:in `<main>'