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

next_rails requires actionview, which depends on activesupport #18

Closed
geetfun opened this issue Mar 30, 2021 · 5 comments
Closed

next_rails requires actionview, which depends on activesupport #18

geetfun opened this issue Mar 30, 2021 · 5 comments

Comments

@geetfun
Copy link

geetfun commented Mar 30, 2021

Problem:

next_rails requires actionview, of which the minimum attainable version is 4.1.0: https://rubygems.org/gems/actionview/versions

In this version, it depends on activesupport version 4.1.2rc:

Bundler could not find compatible versions for gem "activesupport":
  In snapshot (Gemfile.lock):
    activesupport (= 3.2.22.5)

  In Gemfile:
    actionview (~> 4.1) was resolved to 4.1.2.rc1, which depends on
      activesupport (= 4.1.2.rc1)

    rails (= 3.2.22.5) was resolved to 3.2.22.5, which depends on
      activesupport (= 3.2.22.5)

As a result, next_rails cannot be used for Rails 3 upgrade projects.

@geetfun geetfun changed the title next_rails does requires actionview, which depends on activesupport next_rails requires actionview, which depends on activesupport Mar 30, 2021
@etagwerker
Copy link
Member

@geetfun Weird. I thought we resolved that issue over here: #6

What version of next_rails are you using?

@geetfun
Copy link
Author

geetfun commented Mar 30, 2021

@etagwerker It was version 1.0.2 from rubygems.

In the recent project (Rails 3.2), I ended up forking the fastruby/next_rails repo here (https://github.com/geetfun/next_rails) and removed the actionview dependency altogether, and it seemed to work. It looks like the dependency is used for formatting the output (eg. for time_ago_in_words). When it isn't available, the code uses strftime.

Here is the relevant lines in the codebase:

def age
if respond_to?(:time_ago_in_words)
"#{time_ago_in_words(created_at)} ago"
else
created_at.strftime("%b %e, %Y")
end
end

I think the reason it didn't work is because actionview is only available > 4.1, and isn't defined/available in Rails 3.2 as it was still part of ActionPack: https://github.com/rails/rails/blob/v3.2.22.5/actionpack/lib/action_view.rb. And calling actionview will end up bringing in activesupport version 4 as well.

@etagwerker
Copy link
Member

@geetfun I think I know what the problem is, it seems that we haven't pushed v1.0.3 which declares actionview as a development dependency.

v1.0.2 declared actionview as a runtime dependency. I believe that is why you couldn't install it: https://guides.rubygems.org/patterns/#declaring-dependencies

Could you please try running next_rails from GitHub's main branch and report back? I believe this is fixed in main but not yet released in Rubygems...

@geetfun
Copy link
Author

geetfun commented Mar 31, 2021

Could you please try running next_rails from GitHub's main branch and report back? I believe this is fixed in main but not yet released in Rubygems...

Works as you suggested.

gem "next_rails", git: "https://github.com/fastruby/next_rails", ref: "38dd580"

@etagwerker
Copy link
Member

@geetfun Sorry about that. I've created #19 to take care of releasing a new version.

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