soveran / cuba

Rum based microframework for web development.
http://cuba.is
MIT License
1.44k stars 249 forks source link

Fix Rack 2 deprecation warning #92

Closed mauro-oto closed 6 years ago

mauro-oto commented 6 years ago

Since the Rack dependency version was relaxed in the gemspec, using Rack >= 2.0 will now show a deprecation warning. Request#[] was deprecated in https://github.com/rack/rack/pull/1069.

Please check it out, thanks!

soveran commented 6 years ago

Thanks!

soveran commented 6 years ago

This was released as part of Cuba 3.9.1.

Juanmcuello commented 6 years ago

This introduced a breaking change. With version 3.9.0 it was possible to use symbols when capturing params.

get param(:foo) do
  # ...
end

With this change it is not possible anymore. This is due to how [] helper in rack works (it calls key.to_s),

Check https://github.com/rack/rack/pull/1069/commits/7c3d700c00d13e0dead8f110a95606fd1332c5a2

As we can see, req.params[key]is not a direct replacement of req[key]

I think it would be safer to call to_s in order to keep compatibility and remove it in a major release. I can crete a PR if this makes sense.

soveran commented 6 years ago

@Juanmcuello Good catch! I think a PR with a to_s will be perfect and we can release it as version 3.9.2.