Skip to content

Commit

Permalink
pg_search_rank explicit float conversion only needed for ActiveRecord 3
Browse files Browse the repository at this point in the history
  • Loading branch information
amarshall committed Dec 12, 2013
1 parent c10704a commit 1a5563c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/pg_search.rb
Expand Up @@ -5,6 +5,7 @@
require "pg_search/extensions/arel"

module PgSearch
autoload :Compatibility, "pg_search/compatibility"
autoload :Configuration, "pg_search/configuration"
autoload :Document, "pg_search/document"
autoload :Features, "pg_search/features"
Expand All @@ -15,6 +16,7 @@ module PgSearch
autoload :VERSION, "pg_search/version"

extend ActiveSupport::Concern
include Compatibility::ActiveRecord3 if ActiveRecord::VERSION::MAJOR == 3

mattr_accessor :multisearch_options
self.multisearch_options = {}
Expand Down Expand Up @@ -53,10 +55,6 @@ def multisearchable(options = {})
end
end

def pg_search_rank
read_attribute(:pg_search_rank).to_f
end

class << self
def multisearch(*args)
PgSearch::Document.search(*args)
Expand Down
9 changes: 9 additions & 0 deletions lib/pg_search/compatibility.rb
@@ -0,0 +1,9 @@
module PgSearch
module Compatibility
module ActiveRecord3
def pg_search_rank
read_attribute(:pg_search_rank).to_f
end
end
end
end

0 comments on commit 1a5563c

Please sign in to comment.