Commit Graph

24 Commits

Author SHA1 Message Date
Waldyr de Souza f1bc6ced7b enable sort by alias 2021-05-06 16:42:59 +02:00
Yasuo Honda 7eba779fb2 Apply RuboCop auto correct ry running `bundle exec rubocop -a` 2020-12-23 16:23:55 +09:00
Jon Atack 9737bd36df Speed up conditionals 2016-07-26 23:39:24 +02:00
Andrew Vit 235eae3b82 Refactor: condition handles binding of its attribute 2016-02-11 17:35:24 -08:00
Jon Atack 899618e4aa Merge pull request #522 from aldrinmartoq/ransacker-arguments-sort
Ransacker arguments sort
2015-11-18 23:55:24 +01:00
Jon Atack 381a83cebe Freeze strings in array constants and begin moving
from using global constants to frozen strings (cc @avit).

It's not pretty, but it's faster and better for understanding the code
without having to look up what the special constants represent.

From the discussion in #530:

"Things are evolving, but with Ruby 2.2 here is my current
understanding:

- I believe you are correct that the strings inside the array could
benefit from freezing, in hot spots.

- Freezing a string may now be faster than looking up a frozen string
constant.

So, it might make sense now in Ransack master and upcoming releases, to
optimize for Ruby 2.2+ and stop using frozen constants, and replace
them with frozen strings or symbols."

Closes #530.
2015-08-29 22:52:57 +02:00
Aldrin Martoq 973d661007 Added support of ransacker_args to Ransack::Nodes::Sort and related test. 2015-03-17 22:59:00 -03:00
Jon Atack fcbb287839 Handle nil in options passed to sort_link, add test. 2014-12-11 18:31:54 +01:00
Jon Atack 29428ae481 Remove unneeded namespacing 2014-11-21 20:03:20 +01:00
Jon Atack dccc871a72 Move string constants into Ransack::Constants 2014-10-09 23:48:38 +02:00
Jon Atack 3b5c82bd28 Reduce object allocations in Ransack::Nodes::Sort
`try` allocates an array on every call; we should avoid calling
it in hotspots.
2014-10-04 01:25:14 +02:00
Jon Atack ea46d4d8de Reduce object allocations and speed up Ransack by
extracting commonly used strings into top level Ransack
constants.
2014-10-04 00:44:28 +02:00
Washington Luiz b4973315e9 Merge branch 'master' into bring-rails-3
Conflicts:
	.travis.yml
	Gemfile
	README.md
	lib/ransack/adapters/active_record/3.0/context.rb
	lib/ransack/adapters/active_record/3.1/context.rb
	lib/ransack/adapters/active_record/3.2/context.rb
	lib/ransack/adapters/active_record/base.rb
	lib/ransack/adapters/active_record/context.rb
	lib/ransack/constants.rb
	lib/ransack/context.rb
	lib/ransack/helpers/form_builder.rb
	lib/ransack/helpers/form_helper.rb
	lib/ransack/nodes/attribute.rb
	lib/ransack/nodes/condition.rb
	lib/ransack/nodes/grouping.rb
	lib/ransack/nodes/sort.rb
	lib/ransack/predicate.rb
	lib/ransack/translate.rb
	ransack.gemspec
	spec/blueprints/people.rb
	spec/ransack/adapters/active_record/base_spec.rb
	spec/ransack/adapters/active_record/context_spec.rb
	spec/ransack/configuration_spec.rb
	spec/ransack/dependencies_spec.rb
	spec/ransack/helpers/form_builder_spec.rb
	spec/ransack/helpers/form_helper_spec.rb
	spec/ransack/predicate_spec.rb
	spec/ransack/search_spec.rb
	spec/ransack/translate_spec.rb
	spec/support/schema.rb
2014-04-10 00:28:29 -03:00
jonatack 787eb3c1d1 Code cleanup 2013-12-15 19:27:50 +01:00
jonatack 06f99e424c Code cleanup
indentation, spacing, and 80 character max width for readability
2013-12-08 21:51:43 +01:00
jonatack 0a2e4caaa9 Catch up with changes in master branch 2013-12-07 01:51:55 +01:00
Alejandro Babio 3da2427e37 Add auth_object support to attribute & sort nodes when call
ransackable_attributes or ransortable_attributes.
2013-11-22 09:44:27 -03:00
Alejandro Babio 47d7a95eac Allow sort by a field, and not use in search.
Accepts sort column only if it's a ransortable_attribute.

accepts sort column only if it's a ransortable_attribute.
2013-10-25 15:36:52 -03:00
kia84 63b5263886 fixed 'DESC' and 'desc' problem
Fixes #287
2013-10-21 09:56:21 +11:00
kia84 56e7233918 fixed 'DESC' and 'desc' problem
Fixes #287
2013-10-21 09:56:04 +11:00
Ernie Miller cef7b8ecea Workaround for 3.0 not having param_key and fix valid? on attr/sort 2011-04-18 13:59:47 -04:00
Ernie Miller 62cf765c12 Ransacker implementation improvements 2011-04-11 12:04:31 -04:00
Ernie Miller ecd42f4a83 WIP: move away from contextualize, toward bind 2011-04-09 20:55:28 -04:00
Ernie Miller 294015309b Initial commit. 2011-03-30 20:31:39 -04:00