lib/espresso/model.rb in espresso-0.1.0 vs lib/espresso/model.rb in espresso-0.1.1
- old
+ new
@@ -1,13 +1,17 @@
require 'searchlogic'
module Espresso
# @author Alexander Semyonov
module Model
+ unloadable
+
def self.included(model)
- model.extend ClassMethods
- model.send :include, InstanceMethods
+ model.class_eval do
+ extend ClassMethods
+ include InstanceMethods
+ end
end
module ClassMethods
# Paginates search results
#
@@ -22,9 +26,10 @@
query.merge!(self.parse_simple_query(simple_query)) if simple_query
@search = search(query)
@results = @search.paginate(:page => page)
[@search, @results]
end
+ alias_method :search_results, :paginate_found
# Make searchlogic query from simple query option
# Needed to be reimplemented in subclasses
#
# @param [String] simple query string