Permalink
Browse files

Use Arel in DMetaphone#add_normalization

  • Loading branch information...
1 parent 82f05fc commit 64863003302ba75a34825357a3a5a9fb6def61bd @nertzy nertzy committed Apr 2, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/pg_search/features/dmetaphone.rb
@@ -26,8 +26,14 @@ def initialize(normalizer_to_wrap)
end
def add_normalization(original_sql)
- otherwise_normalized_sql = normalizer_to_wrap.add_normalization(original_sql)
- "pg_search_dmetaphone(#{otherwise_normalized_sql})"
+ otherwise_normalized_sql = Arel.sql(
+ normalizer_to_wrap.add_normalization(original_sql)
+ )
+
+ Arel::Nodes::NamedFunction.new(
+ "pg_search_dmetaphone",
+ [otherwise_normalized_sql]
+ ).to_sql
end
private

0 comments on commit 6486300

Please sign in to comment.