activerecord-hackery--ransack/lib
Jon Atack 14e66ca59e FormHelper: convert params#to_unsafe_h only if Rails 5, add tests.
This adresses an issue correctly brought up by @ryanswood in PR #644
concerning Rails 4.2 where params#to_unsafe_h still needs to be
converted from a Hash to a HWIA to respond to symbol hash keys.

I prefer to trying adding a conditional on Active Record version rather
than an extra HWIA conversion.

The tests are run for Rails 4 and 5, since ActionController::Parameters
was backported to 4.x.

Rails 3 raises if ActionController::Parameters is invoked, so the tests
are skipped in that case.

This commit is necessary because when the following is run:

    ActionController::Parameters.new(q: 1).to_unsafe_h.fetch(:q)

with Rails 5 it works, but not with Rails 4.2. The reason is that in
Rails 5, #to_unsafe_h calls
StrongParameters::convert_parameters_to_hashes which converts hashes to
HWIA, whereas in Rails 4.2 it just calls #to_hash without HWIA.
2016-07-14 16:43:00 +02:00
..
ransack FormHelper: convert params#to_unsafe_h only if Rails 5, add tests. 2016-07-14 16:43:00 +02:00
ransack.rb Refactor Ransack::Adapters from conditionals to classes 2016-04-05 11:09:21 +02:00