Permalink
Browse files

Use arel_table so that Searcher is compatible with Rails > 3.0.1

  • Loading branch information...
1 parent dfaa8d8 commit 5aa60e1f0a70d880e220738c24345b1243863942 @radar committed Nov 18, 2010
Showing with 3 additions and 3 deletions.
  1. +1 −1 Gemfile.lock
  2. +2 −2 lib/searcher.rb
  3. BIN searcher.sqlite3
View
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- searcher (0.0.2)
+ searcher (0.0.3)
activerecord (~> 3.0.0)
GEM
View
@@ -12,10 +12,10 @@ def self.classes
ActiveSupport.on_load(:after_initialize) do
Searcher.classes.each do |klass|
- table = Table(klass.table_name)
+ table = klass.arel_table
klass.searcher[:labels].each do |name, config|
association = klass.reflect_on_association(config[:from])
- association_table = Table(association.klass.table_name)
+ association_table = association.klass.arel_table
if [:has_and_belongs_to_many, :belongs_to].include?(association.macro)
scope = lambda { |q, field| klass.joins(config[:from]).where(association_table[field].eq(q)) }
klass.scope "by_#{name}", scope
View
Binary file not shown.

0 comments on commit 5aa60e1

Please sign in to comment.