Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #14 from mezis/rails4
Browse files Browse the repository at this point in the history
Rails4 compatibility
  • Loading branch information
mezis committed Aug 31, 2013
2 parents 31a6880 + 6fe5a88 commit 1988de2
Show file tree
Hide file tree
Showing 19 changed files with 332 additions and 115 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ gemfile:
- gemfiles/rails32.gemfile
- gemfiles/rails32_pg.gemfile
- gemfiles/rails32_mysql.gemfile
- gemfiles/rails40.gemfile
before_install: bundle install
bundler_args:
matrix:
exclude:
- rvm: 2.0.0
gemfile: gemfiles/rails23.gemfile
env: TRAVIS=TRUE
- rvm: 1.8.7
gemfile: gemfiles/rails40.gemfile
- rvm: 1.9.2
gemfile: gemfiles/rails40.gemfile
before_script:
- psql -c 'create database fuzzily_test;' -U postgres
- mysql -e 'create database fuzzily_test;'
env: TRAVIS=TRUE
env:
global:
- TRAVIS=TRUE
4 changes: 4 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ end
appraise "rails32-mysql" do
gem "activerecord", "~> 3.2.0"
end

appraise "rails40" do
gem "activerecord", "~> 4.0.0"
end
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
source ENV.fetch('GEM_SOURCE','https://rubygems.org')

gem "activerecord", "~> 3.2.1"

# Specify your gem's dependencies in fuzzily.gemspec
gemspec

33 changes: 17 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
PATH
remote: .
specs:
fuzzily (0.2.4)
fuzzily (0.3.0)
activerecord (>= 2.3.17)

GEM
remote: http://yarp.dev/
remote: https://rubygems.org/
specs:
activemodel (3.2.14)
activesupport (= 3.2.14)
Expand Down Expand Up @@ -33,12 +33,12 @@ GEM
thor
diff-lcs (1.2.4)
i18n (0.6.5)
method_source (0.8.1)
mime-types (1.23)
method_source (0.8.2)
mime-types (1.25)
multi_json (1.7.9)
mysql2 (0.3.11)
pg (0.15.1)
pry (0.9.12.1)
mysql2 (0.3.13)
pg (0.16.0)
pry (0.9.12.2)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
Expand All @@ -47,27 +47,28 @@ GEM
rake (10.1.0)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.5)
rspec-expectations (2.14.2)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)
rspec-mocks (2.14.3)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
slop (3.4.4)
sqlite3 (1.3.7)
slop (3.4.6)
sqlite3 (1.3.8)
thor (0.18.1)
tzinfo (0.3.37)

PLATFORMS
ruby

DEPENDENCIES
activerecord (~> 3.2.1)
appraisal
coveralls
fuzzily!
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Blurrily finds misspelled, prefix, or partial needles in a haystack of
strings. It's a fast, [trigram](http://en.wikipedia.org/wiki/N-gram)-based, database-backed [fuzzy](http://en.wikipedia.org/wiki/Approximate_string_matching) string search/match engine for Rails.
Loosely inspired from an [old blog post](http://unirec.blogspot.co.uk/2007/12/live-fuzzy-search-using-n-grams-in.html).

Tested with ActiveRecord (2.3, 3.0, 3.1, 3.2) on various Rubies (1.8.7, 1.9.2, 1.9.3, 2.0.0) and the most common adapters (SQLite3, MySQL, and PostgreSQL).
Tested with ActiveRecord (2.3, 3.0, 3.1, 3.2, 4.0) on various Rubies (1.8.7, 1.9.2, 1.9.3, 2.0.0) and the most common adapters (SQLite3, MySQL, and PostgreSQL).

If your dateset is big, if you need yet more speed, or do not use ActiveRecord,
check out [blurrily](http://github.com/mezis/blurrily), another gem (backed with a C extension)
Expand Down Expand Up @@ -71,7 +71,9 @@ Search!
MyStuff.find_by_fuzzy_name('Some Name', :limit => 10)
# => records

You can force an update on a specific record with

MyStuff.find(123).update_fuzzy_name!

## Indexing more than one field

Expand Down Expand Up @@ -131,4 +133,5 @@ Copyright (c) 2013 HouseTrip Ltd.
5. Create a new Pull Request


Thanks to @bclennox and @fdegiuli for helping fix compatibility issues.
Thanks to @bclennox, @fdegiuli, @nickbender, @Shanison for pointing out
and/or helping on various issues.
6 changes: 3 additions & 3 deletions gemfiles/rails23.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: /Users/mezis/Dropbox/Development/fuzzily
specs:
fuzzily (0.2.4)
fuzzily (0.3.0)
activerecord (>= 2.3.17)

GEM
Expand Down Expand Up @@ -48,8 +48,8 @@ GEM
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
slop (3.4.4)
sqlite3 (1.3.7)
slop (3.4.6)
sqlite3 (1.3.8)
thor (0.18.1)

PLATFORMS
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails30.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: /Users/mezis/Dropbox/Development/fuzzily
specs:
fuzzily (0.2.4)
fuzzily (0.3.0)
activerecord (>= 2.3.17)

GEM
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails31.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: /Users/mezis/Dropbox/Development/fuzzily
specs:
fuzzily (0.2.4)
fuzzily (0.3.0)
activerecord (>= 2.3.17)

GEM
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails32.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: /Users/mezis/Dropbox/Development/fuzzily
specs:
fuzzily (0.2.4)
fuzzily (0.3.0)
activerecord (>= 2.3.17)

GEM
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails32_mysql.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: /Users/mezis/Dropbox/Development/fuzzily
specs:
fuzzily (0.2.4)
fuzzily (0.3.0)
activerecord (>= 2.3.17)

GEM
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails32_pg.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: /Users/mezis/Dropbox/Development/fuzzily
specs:
fuzzily (0.2.4)
fuzzily (0.3.0)
activerecord (>= 2.3.17)

GEM
Expand Down
7 changes: 7 additions & 0 deletions gemfiles/rails40.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord", "~> 4.0.0"

gemspec :path=>"../"
89 changes: 89 additions & 0 deletions gemfiles/rails40.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
PATH
remote: /Users/mezis/Dropbox/Development/fuzzily
specs:
fuzzily (0.3.0)
activerecord (>= 2.3.17)

GEM
remote: https://rubygems.org/
specs:
activemodel (4.0.0)
activesupport (= 4.0.0)
builder (~> 3.1.0)
activerecord (4.0.0)
activemodel (= 4.0.0)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.0)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.0)
i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
appraisal (0.5.2)
bundler
rake
arel (4.0.0)
atomic (1.1.13)
builder (3.1.4)
coderay (1.0.9)
colorize (0.5.8)
coveralls (0.6.7)
colorize
multi_json (~> 1.3)
rest-client
simplecov (>= 0.7)
thor
diff-lcs (1.2.4)
i18n (0.6.5)
method_source (0.8.2)
mime-types (1.25)
minitest (4.7.5)
multi_json (1.7.9)
mysql2 (0.3.13)
pg (0.16.0)
pry (0.9.12.2)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
pry-nav (0.2.3)
pry (~> 0.9.10)
rake (10.1.0)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.5)
rspec-expectations (2.14.2)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.3)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
slop (3.4.6)
sqlite3 (1.3.8)
thor (0.18.1)
thread_safe (0.1.2)
atomic
tzinfo (0.3.37)

PLATFORMS
ruby

DEPENDENCIES
activerecord (~> 4.0.0)
appraisal
coveralls
fuzzily!
mysql2
pg
pry
pry-nav
rake
rspec
sqlite3
2 changes: 1 addition & 1 deletion lib/fuzzily.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
require "fuzzily/model"
require "active_record"

ActiveRecord::Base.extend(Fuzzily::Searchable)
ActiveRecord::Base.send :include, Fuzzily::Searchable

0 comments on commit 1988de2

Please sign in to comment.