Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaks rails generate. Rails 7 compat? #184

Closed
pboling opened this issue Dec 7, 2022 · 7 comments
Closed

Breaks rails generate. Rails 7 compat? #184

pboling opened this issue Dec 7, 2022 · 7 comments

Comments

@pboling
Copy link

pboling commented Dec 7, 2022

I am using service_actor-rails which provides an actor generator, and when I try to use it, while having this slim-rails gem installed, it blows up inside slim-rails. It appears to be incompatible with Rails v7?

rails generate actor do_something

Error:

/Users/pboling/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/slim-0.6.1/lib/slim/rails.rb:5:in `<module:TemplateHandlers>': uninitialized constant ActionView::TemplateHandlers::TemplateHandler

    class SlimHandler < TemplateHandler
                        ^^^^^^^^^^^^^^^
Did you mean?  ActionView::TemplateRenderer (NameError)
        from /Users/pboling/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/slim-0.6.1/lib/slim/rails.rb:4:in `<module:ActionView>'
        from /Users/pboling/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/slim-0.6.1/lib/slim/rails.rb:3:in `<top (required)>'
        from /Users/pboling/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
        from /Users/pboling/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'

@pboling pboling changed the title Breaks rails generate Breaks rails generate. Rails 7 compat? Dec 7, 2022
@januszm
Copy link
Contributor

januszm commented Dec 7, 2022

slim-rails is compatible with Rails 7. In your case it looks like you are using a very old version of slim: gems/slim-0.6.1/lib/slim/rails.rb , 0.6.1 , please make sure you're using the most recent versions of both slim-rails and slim gems.

@pboling
Copy link
Author

pboling commented Dec 8, 2022

For both I did bundle add slim and bundle add slim-rails, and these were the versions I got. I am on Rails 7.0.4 and Ruby 3.1.3. I don't understand why it would give me an old version. Looking into it.

@pboling
Copy link
Author

pboling commented Dec 8, 2022

$ bundle outdated
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies....

Gem         Current  Latest   Requested  Groups
nokogiri    1.13.9   1.13.10
rack        2.2.4    3.0.2
slim        0.6.1    4.1.0    ~> 0.6.1   default
slim-rails  0.1.2    3.5.1    ~> 0.1.2   default

SO strange.

@pboling
Copy link
Author

pboling commented Dec 8, 2022

OK, I removed the constraints that were added by bundle add, and did a generic bundle update, and got the following:

...
Installing temple 0.8.2 (was 0.9.1)
...
Fetching slim 4.1.0 (was 0.6.1)
Installing slim 4.1.0 (was 0.6.1)
Fetching slim-rails 3.5.1 (was 0.1.2)
Installing slim-rails 3.5.1 (was 0.1.2)
Bundle updated!

I think the version of temple in my Gemfile.lock that was pre-existing had already eclipsed the older version that slim requires, and so it installed a version of slim so old that it predated the specific version requirement on temple. An oddity of higher specificity. 😆

Are there plans to loosen the temple restriction, or is it necessary?

s.add_runtime_dependency('temple', ['>= 0.7.6', '!= 0.9.0'])

@pboling
Copy link
Author

pboling commented Dec 8, 2022

It is also strange that != 0.9.0 disallowed 0.9.1... Is that expected behavior from bundler? My impression has been that != was to skip specific versions within an interval of otherwise compatible versions... which would mean it should accept 0.9.1...

@pboling
Copy link
Author

pboling commented Dec 8, 2022

Or maybe the latest master hasn't been released. When I add a discrete temple to my Gemfile:

gem 'temple', '~> 0.9.1'

I get:

Bundler could not find compatible versions for gem "temple":
  In Gemfile:
    temple (~> 0.9.1)

    slim (~> 4.1) was resolved to 4.1.0, which depends on
      temple (>= 0.7.6, < 0.9)

If that's true then the latest release from 2020-05-08 is unusable for a specific scenario of Bundler + temple. It looks like the change to support temple v0.9.1 was made on 2022-10-25, so perhaps a new release is forthcoming?

But... that's not even this repo...

For now I'm pointing my Gemfile to git for slim. 👯

@pboling
Copy link
Author

pboling commented Dec 8, 2022

Relevant issues / PRs:
slim-template/slim#894
slim-template/slim#897

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants