jsonapi-rb / jsonapi-rails

Rails gem for fast jsonapi-compliant APIs.
http://jsonapi-rb.org
MIT License
319 stars 63 forks source link

Do not redefine renderers #76

Closed nodecarter closed 5 years ago

nodecarter commented 6 years ago

When I run specs on my service which use jsonapi-rails I see a lot of warnings:

.../gems/ruby-2.3.4/gems/actionpack-5.1.4/lib/action_controller/metal/renderers.rb:75: warning: method redefined; discarding old _render_with_renderer_jsonapi
.../gems/ruby-2.3.4/gems/jsonapi-rails-0.3.1/lib/jsonapi/rails/railtie.rb:51: warning: previous definition of _render_with_renderer_jsonapi was here
.../gems/ruby-2.3.4/gems/actionpack-5.1.4/lib/action_controller/metal/renderers.rb:75: warning: method redefined; discarding old _render_with_renderer_jsonapi_errors
.../gems/ruby-2.3.4/gems/jsonapi-rails-0.3.1/lib/jsonapi/rails/railtie.rb:51: warning: previous definition of _render_with_renderer_jsonapi_errors was here

Gemfile.lock:

    ...
    jsonapi-deserializable (0.2.0)
    jsonapi-parser (0.1.1)
    jsonapi-rails (0.3.1)
      jsonapi-parser (~> 0.1.0)
      jsonapi-rb (~> 0.5.0)
    jsonapi-rb (0.5.0)
      jsonapi-deserializable (~> 0.2.0)
      jsonapi-serializable (~> 0.3.0)
    jsonapi-renderer (0.2.0)
    jsonapi-serializable (0.3.0)
      jsonapi-renderer (~> 0.2.0)
    ...

This PR solve this. Not sure that this is the right way but it works.

beauby commented 6 years ago

Hey @nodecarter – thanks for the PR. As you mentioned, I'm not sure either this is the right way of fixing this. I'd like to understand why the railtie is ran more than once in the first place.

nodecarter commented 5 years ago

@beauby I think this PR is not relevant more, so I'm closing this PR. (I did not test) Thank you for your work!