Commit Graph

28 Commits

Author SHA1 Message Date
nhuthuy-1719 f7225de3cd Fixes #82 Case Insensitive Searching 2019-11-05 22:54:02 +07:00
Sean Linsley f570a402bf improve memory usage 2017-12-31 20:30:53 -06:00
Andrew Vit 3df134e08e Tell if a condition is negative 2016-02-16 01:07:54 -08: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
Michael Pavling 0abaab4b1e allowing ':wants_array' to be passed as 'false' in predicate options 2015-03-24 09:01:37 +00:00
Jon Atack 76191612ad #none? should be much faster than select#empty?
∴ rake benchmarks:select_empty_versus_none
Calculating -------------------------------------
       select.empty?     2.581k i/100ms
               none?    12.755k i/100ms
-------------------------------------------------
       select.empty?     28.826k (± 6.3%) i/s -    144.536k
               none?    268.873k (± 5.9%) i/s -      1.352M

Comparison:
               none?:   268873.0 i/s
       select.empty?:    28826.3 i/s - 9.33x slower
2014-12-10 19:25:05 +01:00
Jon Atack 29428ae481 Remove unneeded namespacing 2014-11-21 20:03:20 +01:00
Jon Atack 3a4cce0b6c Comment out unused methods while figuring out what
they were intended for.
2014-10-23 23:11:40 +02:00
Jon Atack dccc871a72 Move string constants into Ransack::Constants 2014-10-09 23:48:38 +02:00
Jon Atack 46ab1030f7 Reference string constants rather than repeatedly
allocating the same string in order to deduplicate
commonly-used strings, reduce object allocations
and memory usage.
2014-10-06 23:27:55 +02:00
Jon Atack 1abf8f6086 Maintain Ruby 1.8.7 syntax compatibility
since Rails 3.x stills supports Ruby 1.8.7 as per
http://guides.rubyonrails.org/v3.2.17/getting_started.html:
“Ruby language version 1.8.7 or higher.”
2014-05-01 15:55:39 +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 cb84f7f7b5 Minor code cleanup
80 characters screen width
2013-12-15 18:51:48 +01:00
jonatack 7d452627dd Code cleanup 2013-12-10 10:52:46 +01:00
jonatack 984059e63f Code cleanup 2013-12-09 11:05:10 +01:00
jonatack 0a2e4caaa9 Catch up with changes in master branch 2013-12-07 01:51:55 +01:00
Sean Linsley 98948773e4 improve predicate lookup performance from .7 ms to .1 ms
Fixes #309
2013-11-28 10:58:53 +11:00
Sean Linsley 21a05656c3 improve predicate lookup performance from .7 ms to .1 ms
Fixes #309
2013-11-28 10:58:15 +11:00
jonatack 49c1e3134c Use Ruby 1.9 hash syntax 2013-08-04 15:13:41 +02:00
Asfand Qazi afdd357fae Allow adding of custom predicates that take arrays (like IN/NOT IN) 2012-05-02 07:54:12 +01:00
Ernie Miller 6fa15a20cd Don't use present? to check for presence (allow false as value). Fixes #9 2011-07-17 10:46:30 -04:00
Ernie Miller 59dd9ae754 Handle null/not null properly. Fixes #8 2011-07-15 07:17:02 -04:00
Ernie Miller ff8138c32e Cast values when determining if condition is valid. Fixes errors on blank dates 2011-06-22 22:16:44 -04:00
Ernie Miller e5c7d8be2b DRY up predicate detection, add some starter docs 2011-06-06 21:32:03 -04:00
Ernie Miller 1c41a3ea2c Add :only/:compound options to predicate_select, refactor ands/ors -> groupings 2011-06-05 14:29:54 -04:00
Ernie Miller 62cf765c12 Ransacker implementation improvements 2011-04-11 12:04:31 -04:00
Ernie Miller 11dd0d63f4 WIP: refactor type casting behavior to better support ranasckers 2011-04-10 21:11:28 -04:00
Ernie Miller 294015309b Initial commit. 2011-03-30 20:31:39 -04:00