Browse files

Removed SearchLogic

  • Loading branch information...
1 parent d07f2bd commit a7160face85be0a3dc3d2c6880f6327cd9892b9a @alsemyonov committed May 11, 2011
Showing with 3 additions and 23 deletions.
  1. +3 −6 lib/espresso/collection.rb
  2. +0 −17 lib/espresso/collection/searchlogic.rb
View
9 lib/espresso/collection.rb
@@ -1,11 +1,12 @@
-require 'active_support/core_ext/class'
+require 'active_support/core_ext/class/attribute'
module Espresso
self.extensions << :collection
+
# Represents collection of resources.
# Used in Espresso::Controller InheritedResources extension
class Collection < Array
- cattr_accessor :per_page
+ class_attribute :per_page
self.per_page = 30
attr_accessor :base, :options, :collection, :search
@@ -35,10 +36,6 @@ def method_missing(method_name, *args)
end
end
-if defined? Searchlogic
- require 'espresso/collection/searchlogic'
-end
-
if defined? WillPaginate
require 'espresso/collection/will_paginate'
end
View
17 lib/espresso/collection/searchlogic.rb
@@ -1,17 +0,0 @@
-require 'espresso/collection'
-require 'searchlogic'
-
-module Espresso
- class Collection
- # Use ActiveRecord::Base#searchlogic method to generate
- # base for finding the collection
- # @return [ActiveRecord::Base] ActiveRecord model scoped with searchlogic
- def base
- unless @search
- search_options = options.delete(:search) { {} }
- @search = @base.searchlogic(search_options)
- end
- @search
- end
- end
-end

0 comments on commit a7160fa

Please sign in to comment.