1
0
Fork 0
mirror of https://github.com/activerecord-hackery/ransack.git synced 2022-11-09 13:47:45 -05:00
activerecord-hackery--ransack/lib/ransack
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
..
adapters Add new method stubs for mongoid 2016-02-16 12:30:28 -08:00
helpers FormHelper: convert params#to_unsafe_h only if Rails 5, add tests. 2016-07-14 16:43:00 +02:00
locale [skip ci] adjusting pt-BR locale null key 2016-06-16 15:09:11 -03:00
nodes Ensure conditions differing only by ransacker_args aren't filtered out by uniq\! 2016-04-27 14:26:42 -04:00
adapters.rb Refactor Ransack::Adapters from conditionals to classes 2016-04-05 11:09:21 +02:00
configuration.rb Add documentation for Ransack configuration options 2015-08-28 00:00:42 +02:00
constants.rb Freeze strings in array constants and begin moving 2015-08-29 22:52:57 +02:00
context.rb Refactor Ransack::Adapters from conditionals to classes 2016-04-05 11:09:21 +02:00
helpers.rb Initial commit. 2011-03-30 20:31:39 -04:00
naming.rb Fix #518: undefined method model_name 2015-03-31 21:25:55 +05:30
nodes.rb Refactor Ransack::Adapters from conditionals to classes 2016-04-05 11:09:21 +02:00
predicate.rb Tell if a condition is negative 2016-02-16 01:07:54 -08:00
ransacker.rb Maintain Ruby 1.8.7 syntax compatibility 2014-05-01 15:55:39 +02:00
search.rb Use Ransack::Adapters.object_mapper.require_search to match the new refactored Ransack::Adapters (Fixed the build) 2016-04-05 18:46:37 +01:00
translate.rb Freeze strings in array constants and begin moving 2015-08-29 22:52:57 +02:00
version.rb Release 1.7.0 2015-08-20 12:46:41 +02:00
visitor.rb Revert 846b168 2014-12-20 23:50:10 +01:00