Closed nicksoto closed 3 years ago
Based on that commit and seeing other repos that have updated to account for the deprecation warning, I think we just need to change this line: https://github.com/ccocchi/rabl-rails/blob/4d3ec11096a840d2d1cd43c7a59d92294d0b8323/lib/rabl-rails/library.rb#L28 to do the following instead:
format = view.lookup_context.formats.first || :json
Note: I'm not sure if that change would work on older Rails versions though.
I think this change in that same commit Nick shared backs the above suggestion since the rendered_format
was set with the same value.
The rspec-rails
gem has addressed the same issue here: https://github.com/rspec/rspec-rails/pull/2100 so that should confirm the solution and that the change has to be conditional for Rails 6 and then anything else for older versions.
Something like this :
format = (::Rails::VERSION::STRING >= '6' ? view.lookup_context.formats.first : view.lookup_context.rendered_format) || :json
Thank you, the warning have been removed in version 0.6.0
🙂
the relevant commit is here