Skip to content

Conversation

cassiascheffer
Copy link

@cassiascheffer cassiascheffer commented Sep 24, 2019

When installing jsonapi-rails on a Rails 4.1.6 project with Rack 1.5.5 I got an error that the application could not load "rack/media_type". Rack::MediaType was added in Rack v 2.0.7 as per this commit: rack/rack@a193c57#diff-6f6cb23995312fff1e356f47a3e2a51f.

Credit to @albertxie for pointing this error out.


Before

Before adding this line I could add the jsonapi-rails gem and run bundle install. But I ran into this error when I ran rails c.

/Users/cassidy/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.1.16/lib/active_support/dependencies.rb:247:in `require': cannot load such file -- rack/media_type (LoadError)
        from /Users/cassidy/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.1.16/lib/active_support/dependencies.rb:247:in `block in require'
        from /Users/cassidy/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.1.16/lib/active_support/dependencies.rb:232:in `load_dependency'
        from /Users/cassidy/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/activesupport-4.1.16/lib/active_support/dependencies.rb:247:in `require'
        from /Users/cassidy/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/bundler/gems/jsonapi-rails-716e18b1cc84/lib/jsonapi/rails/filter_media_type.rb:1:in `<top (required)>'

After

After adding this change to the gemspec and running bundle install, I get an informative error:

Resolving dependencies......
Bundler could not find compatible versions for gem "rack":
  In snapshot (Gemfile.lock):
    rack (= 1.5.5)

  In Gemfile:
    activeadmin (~> 1.0.0.pre5) was resolved to 1.0.0.pre5, which depends on
      formtastic (~> 3.1) was resolved to 3.1.5, which depends on
        actionpack (>= 3.2.13) was resolved to 4.1.16, which depends on
          rack (~> 1.5.2)

    jsonapi-rails was resolved to 0.4.0, which depends on
      rack (~> 2.0.7)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

When installing jsonapi-rails on a Rails 4.1.6 project with Rack
1.5.5 I got an error that the application could not load
"rack/media_type". Rack::MediaType was added in Rack v 2.0.7 as per this
commit:
rack/rack@a193c57#diff-6f6cb23995312fff1e356f47a3e2a51f
@cassiascheffer cassiascheffer changed the title Adding the minimum rack version required. Adding the minimum rack version required to gemspec Sep 24, 2019
@remear
Copy link
Member

remear commented Feb 24, 2022

Thanks for this. Rails 4 support ended a long time ago so I'm going to close this out. We'll set the minimum Rack version to a more-recent version if we see more reports of incompatibilities.

@remear remear closed this Feb 24, 2022
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

Successfully merging this pull request may close these issues.

2 participants