annotate_models icon indicating copy to clipboard operation
annotate_models copied to clipboard

Rails 8.0 Support

Open andynu opened this issue 1 year ago • 12 comments

The gem should work with Rails 8.0

Commands

gem install rails
rails new example
cd example
bundle add annotate --version '3.2.0'

Outcome:

Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Could not find compatible versions

Because annotate >= 3.2.0 depends on activerecord >= 3.2, < 8.0
  and rails >= 8.0.0 depends on activerecord = 8.0.0,
  annotate >= 3.2.0 is incompatible with rails >= 8.0.0.
So, because Gemfile depends on rails ~> 8.0.0
  and Gemfile depends on annotate = 3.2.0,
  version solving has failed.

Version

  • annotate version 3.2.0
  • rails version 8.0.0
  • ruby version 3.3.5

andynu avatar Nov 08 '24 15:11 andynu

PR: https://github.com/ctran/annotate_models/pull/1033

davidrunger avatar Nov 08 '24 17:11 davidrunger

Per this thread, it seems like this gem might not be maintained anymore, and many people are moving to the fork https://github.com/drwl/annotaterb (annotaterb), which is already compatible with Rails 8.

Note, however, that the annotaterb fork is not an exact drop-in replacement. There are some changes in the syntax of the CLI command(s), and I found that many of the CLI options seem not to work for me, and instead I must specify the options that I want via a .annotaterb.yml config file, rather than via command line flags.

davidrunger avatar Nov 08 '24 17:11 davidrunger

@davidrunger thx for pointing this. The maintainer of this project should then put it in archive mode and let the community know where to go...

spaquet avatar Nov 12 '24 22:11 spaquet

@spaquet Correct, I didn't know that this gem was abandonware. Please @ctran, @Adeynack, @n-rodriguez, @lovro-bikic can any of you confirm if that is the case so we can all move on?

aitor avatar Nov 13 '24 15:11 aitor

@aitor Hi there! Actually I'm not a maintainer of annotate_model (only a contributor) but I've finally switched to https://github.com/drwl/annotaterb. It works and seems to be well maintained 👍 So feel free to move on it.

n-rodriguez avatar Nov 13 '24 16:11 n-rodriguez

Dear @aitor : Same as @n-rodriguez: I contributed only 2 PRs here. I am not a maintainer. I learn right now of this, as you are posting those. 😮

Thanks @aitor for the suggestion. I will give it a look ASAP.

Adeynack avatar Nov 14 '24 14:11 Adeynack

It's not working here with a recent update.

Let me know if you need further information.

~/w/t/flow_climate (main ± ) ∫ annotate --models                                                           [11:32:20]
/Users/celsomartins/.rvm/gems/ruby-3.3.6@flow_climate/gems/annotate-2.6.5/bin/annotate:3:in `<top (required)>': undefined method `exists?' for class File (NoMethodError)

unless File.exists?('./Rakefile') || File.exists?('./Gemfile')
           ^^^^^^^^
Did you mean?  exist?
	from /Users/celsomartins/.rvm/gems/ruby-3.3.6@flow_climate/bin/annotate:25:in `load'
	from /Users/celsomartins/.rvm/gems/ruby-3.3.6@flow_climate/bin/annotate:25:in `<main>'
	from /Users/celsomartins/.rvm/gems/ruby-3.3.6@flow_climate/bin/ruby_executable_hooks:22:in `eval'
	from /Users/celsomartins/.rvm/gems/ruby-3.3.6@flow_climate/bin/ruby_executable_hooks:22:in `<main>'

celsoMartins avatar Nov 27 '24 14:11 celsoMartins

@celsoMartins switch to https://github.com/drwl/annotaterb 😏

n-rodriguez avatar Nov 27 '24 14:11 n-rodriguez

OMG.

Okay, I'll do that.

Thanks.

celsoMartins avatar Nov 27 '24 14:11 celsoMartins

Got error for the new rails

Because annotate >= 3.2.0 depends on activerecord >= 3.2, < 8.0 and rails >= 8.0.1 depends on activerecord = 8.0.1, annotate >= 3.2.0 is incompatible with rails >= 8.0.1. So, because Gemfile depends on rails ~> 8.0.1 and Gemfile depends on annotate = 3.2.0, version solving has failed.

Working fine with the fixes

` class File class << self alias exists? exist? unless method_defined?(:exists?) end end

unless defined?(Fixnum) Fixnum = Integer end

unless defined?(Bignum) Bignum = Integer end `

bublik avatar Feb 19 '25 14:02 bublik

@bublik switch to https://github.com/drwl/annotaterb 😏

n-rodriguez avatar Feb 19 '25 20:02 n-rodriguez

@bublik switch to https://github.com/drwl/annotaterb 😏

It works like a charm, thanks a lot @n-rodriguez ! 🙇 🙌

foxmerald avatar Mar 07 '25 14:03 foxmerald