acts_as_ferret 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/README +6 -0
  2. data/doc/demo/Gemfile +18 -0
  3. data/doc/demo/Rakefile +3 -6
  4. data/doc/demo/app/controllers/application_controller.rb +3 -0
  5. data/doc/demo/app/helpers/application_helper.rb +0 -1
  6. data/doc/demo/app/views/admin/backend/search.rhtml +1 -1
  7. data/doc/demo/app/views/contents/edit.rhtml +1 -1
  8. data/doc/demo/app/views/contents/new.rhtml +1 -1
  9. data/doc/demo/app/views/searches/search.html.erb +1 -1
  10. data/doc/demo/config.ru +4 -0
  11. data/doc/demo/config/application.rb +57 -0
  12. data/doc/demo/config/boot.rb +4 -107
  13. data/doc/demo/config/database.yml +16 -24
  14. data/doc/demo/config/environment.rb +4 -68
  15. data/doc/demo/config/environments/development.rb +22 -12
  16. data/doc/demo/config/environments/production.rb +43 -13
  17. data/doc/demo/config/environments/test.rb +32 -16
  18. data/doc/demo/config/initializers/backtrace_silencers.rb +7 -0
  19. data/doc/demo/config/initializers/inflections.rb +10 -0
  20. data/doc/demo/config/initializers/mime_types.rb +5 -0
  21. data/doc/demo/config/initializers/secret_token.rb +7 -0
  22. data/doc/demo/config/initializers/session_store.rb +13 -0
  23. data/doc/demo/config/locales/en.yml +5 -0
  24. data/doc/demo/config/routes.rb +4 -5
  25. data/doc/demo/public/404.html +23 -5
  26. data/doc/demo/public/422.html +26 -0
  27. data/doc/demo/public/500.html +23 -5
  28. data/doc/demo/public/images/rails.png +0 -0
  29. data/doc/demo/public/index.html +50 -88
  30. data/doc/demo/public/javascripts/application.js +2 -0
  31. data/doc/demo/public/javascripts/controls.js +965 -0
  32. data/doc/demo/public/javascripts/dragdrop.js +974 -0
  33. data/doc/demo/public/javascripts/effects.js +1123 -0
  34. data/doc/demo/public/javascripts/prototype.js +6001 -0
  35. data/doc/demo/public/javascripts/rails.js +191 -0
  36. data/doc/demo/public/robots.txt +5 -1
  37. data/doc/demo/script/rails +6 -0
  38. data/doc/demo/test/functional/admin/backend_controller_test.rb +1 -1
  39. data/doc/demo/test/functional/contents_controller_test.rb +1 -2
  40. data/doc/demo/test/functional/searches_controller_test.rb +1 -2
  41. data/doc/demo/test/performance/browsing_test.rb +9 -0
  42. data/doc/demo/test/test_helper.rb +13 -18
  43. data/doc/demo/test/unit/comment_test.rb +4 -4
  44. data/doc/demo/test/unit/content_test.rb +6 -4
  45. data/doc/demo/test/unit/ferret_result_test.rb +2 -3
  46. data/doc/demo/test/unit/multi_index_test.rb +2 -3
  47. data/doc/demo/test/unit/remote_index_test.rb +2 -2
  48. data/doc/demo/test/unit/shared_index1_test.rb +2 -3
  49. data/doc/demo/test/unit/shared_index2_test.rb +2 -3
  50. data/doc/demo/test/unit/sort_test.rb +2 -2
  51. data/doc/demo/test/unit/special_content_test.rb +3 -4
  52. data/lib/acts_as_ferret.rb +17 -3
  53. data/lib/acts_as_ferret/blank_slate.rb +11 -10
  54. data/lib/acts_as_ferret/class_methods.rb +9 -7
  55. data/lib/acts_as_ferret/ferret_find_methods.rb +5 -1
  56. data/lib/acts_as_ferret/ferret_result.rb +11 -4
  57. data/lib/acts_as_ferret/multi_index.rb +8 -1
  58. data/lib/acts_as_ferret/search_results.rb +0 -1
  59. data/lib/acts_as_ferret/version.rb +1 -1
  60. metadata +23 -44
  61. data/doc/demo/test/fixtures/remote_contents.yml +0 -9
  62. data/doc/demo/vendor/plugins/will_paginate/LICENSE +0 -18
  63. data/doc/demo/vendor/plugins/will_paginate/README +0 -108
  64. data/doc/demo/vendor/plugins/will_paginate/Rakefile +0 -23
  65. data/doc/demo/vendor/plugins/will_paginate/init.rb +0 -21
  66. data/doc/demo/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +0 -45
  67. data/doc/demo/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +0 -44
  68. data/doc/demo/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +0 -159
  69. data/doc/demo/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +0 -95
  70. data/doc/demo/vendor/plugins/will_paginate/test/array_pagination_test.rb +0 -23
  71. data/doc/demo/vendor/plugins/will_paginate/test/boot.rb +0 -27
  72. data/doc/demo/vendor/plugins/will_paginate/test/console +0 -10
  73. data/doc/demo/vendor/plugins/will_paginate/test/finder_test.rb +0 -219
  74. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/admin.rb +0 -3
  75. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/companies.yml +0 -24
  76. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/company.rb +0 -23
  77. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/developer.rb +0 -11
  78. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml +0 -13
  79. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/project.rb +0 -4
  80. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/projects.yml +0 -7
  81. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/replies.yml +0 -20
  82. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/reply.rb +0 -5
  83. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/schema.sql +0 -44
  84. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/topic.rb +0 -19
  85. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/topics.yml +0 -30
  86. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/user.rb +0 -2
  87. data/doc/demo/vendor/plugins/will_paginate/test/fixtures/users.yml +0 -35
  88. data/doc/demo/vendor/plugins/will_paginate/test/helper.rb +0 -42
  89. data/doc/demo/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb +0 -64
  90. data/doc/demo/vendor/plugins/will_paginate/test/lib/load_fixtures.rb +0 -10
  91. data/doc/demo/vendor/plugins/will_paginate/test/pagination_test.rb +0 -136
@@ -1,12 +1,20 @@
1
1
  module ActsAsFerret
2
- if defined?(BasicObject)
2
+
3
+ if defined?(ActiveSupport::BasicObject)
4
+ # Rails 2.3, 3.x
5
+ class BlankSlate < ActiveSupport::BasicObject
6
+ end
7
+
8
+ elsif defined?(::BasicObject)
3
9
  # Ruby 1.9.x
4
10
  class BlankSlate < BasicObject
5
11
  end
6
- elsif defined?(BlankSlate)
7
- # Rails 2.x has it already
12
+
13
+ elsif defined?(::BlankSlate)
14
+ # former 2.x rails versions (?)
8
15
  class BlankSlate < ::BlankSlate
9
16
  end
17
+
10
18
  else
11
19
  # 'backported' for Rails pre 2.0
12
20
  #
@@ -37,13 +45,6 @@ module ActsAsFerret
37
45
  end
38
46
  end
39
47
 
40
- # Redefine a previously hidden method so that it may be called on a blank
41
- # slate object.
42
- #
43
- # no-op here since we don't hide the methods we reveal where this is
44
- # used in this implementation
45
- def reveal(name)
46
- end
47
48
  end
48
49
 
49
50
  instance_methods.each { |m| hide(m) }
@@ -65,7 +65,7 @@ module ActsAsFerret
65
65
  logger.warn "#{self.name}: Override records_modified_since(time) to keep the index up to date with records changed during rebuild."
66
66
  []
67
67
  else
68
- find :all, :conditions => [ condition.join(' AND '), *([time]*condition.size) ]
68
+ where([ condition.join(' AND '), *([time]*condition.size) ]).all
69
69
  end
70
70
  end
71
71
 
@@ -74,14 +74,14 @@ module ActsAsFerret
74
74
  transaction do
75
75
  if use_fast_batches?
76
76
  offset = 0
77
- while (rows = find :all, :conditions => [ "#{table_name}.id > ?", offset ], :limit => batch_size).any?
77
+ while (rows = where([ "#{table_name}.id > ?", offset ]).limit(batch_size).all).any?
78
78
  offset = rows.last.id
79
79
  yield rows, offset
80
80
  end
81
81
  else
82
82
  order = "#{primary_key} ASC" # fixes #212
83
83
  0.step(self.count, batch_size) do |offset|
84
- yield find( :all, :limit => batch_size, :offset => offset, :order => order ), offset
84
+ yield scoped.limit(batch_size).offset(offset).order(order).all, offset
85
85
  end
86
86
  end
87
87
  end
@@ -92,9 +92,9 @@ module ActsAsFerret
92
92
  transaction do
93
93
  offset = 0
94
94
  ids.each_slice(batch_size) do |id_slice|
95
- records = find( :all, :conditions => ["id in (?)", id_slice] )
95
+ records = where(:id => id_slice).all
96
96
  #yield records, offset
97
- yield find( :all, :conditions => ["id in (?)", id_slice] ), offset
97
+ yield where(:id => id_slice).all, offset
98
98
  offset += batch_size
99
99
  end
100
100
  end
@@ -146,8 +146,10 @@ module ActsAsFerret
146
146
  # +page+ and +per_page+ are supposed to work regardless of any
147
147
  # +conditions+ present in +find_options+.
148
148
  def find_with_ferret(q, options = {}, find_options = {})
149
- if respond_to?(:scope) && scope(:find, :conditions)
150
- find_options[:conditions] ||= '1=1' # treat external scope the same as if :conditions present (i.e. when it comes to counting results)
149
+ if self.scoped.to_sql =~ /WHERE/ && self.scoped.where_values_hash.empty?
150
+ # Treat external scope the same as if :conditions present
151
+ # (i.e. when it comes to counting results).
152
+ find_options[:conditions] ||= '1=1'
151
153
  end
152
154
  return ActsAsFerret::find q, self, options, find_options
153
155
  end
@@ -108,7 +108,11 @@ module ActsAsFerret
108
108
 
109
109
  q = process_query(query, options)
110
110
  q = scope_query_to_models q, options[:models] #if shared?
111
- logger.debug "query: #{query}\n-->#{q}"
111
+
112
+ # Force q to be encoded as UTF-8 to avoid barfing when unicode passed in.
113
+ # Was not an issue pre ruby 1.9.x force_encoding method is only available in ruby 1.9.x
114
+ q_to_s = q.to_s.respond_to?('force_encoding') ? q.to_s.force_encoding('UTF-8') : q
115
+ logger.debug "query: #{query}\n-->#{q_to_s}"
112
116
  s = searcher
113
117
  total_hits = s.search_each(q, options) do |hit, score|
114
118
  doc = s[hit]
@@ -12,7 +12,6 @@ module ActsAsFerret
12
12
  class FerretResult < ActsAsFerret::BlankSlate
13
13
  include ResultAttributes
14
14
  attr_accessor :id
15
- reveal :methods
16
15
 
17
16
  def initialize(model, id, score, rank, data = {})
18
17
  @model = model.constantize
@@ -24,7 +23,7 @@ module ActsAsFerret
24
23
  end
25
24
 
26
25
  def inspect
27
- "#<FerretResult wrapper for #{@model} with id #{@id}"
26
+ "#<FerretResult wrapper for #{@model} with id #{@id}>"
28
27
  end
29
28
 
30
29
  def method_missing(method, *args, &block)
@@ -36,7 +35,10 @@ module ActsAsFerret
36
35
  end
37
36
 
38
37
  def respond_to?(name)
39
- methods.include?(name.to_s) || @data.has_key?(name.to_sym) || to_record.respond_to?(name)
38
+ [ :ferret_score, :ferret_rank,
39
+ :inspect, :method_missing, :respond_to?, :to_record, :to_param, :id
40
+ ].include?(name) ||
41
+ @data.has_key?(name.to_sym) || to_record.respond_to?(name)
40
42
  end
41
43
 
42
44
  def to_record
@@ -45,9 +47,14 @@ module ActsAsFerret
45
47
  @ar_record.ferret_rank = ferret_rank
46
48
  @ar_record.ferret_score = ferret_score
47
49
  # don't try to fetch attributes from RDig based records
48
- @use_record = !@ar_record.class.included_modules.include?(ActsAsFerret::RdigAdapter)
50
+ @use_record = !@ar_record.class.included_modules.include?(::ActsAsFerret::RdigAdapter)
49
51
  end
50
52
  @ar_record
51
53
  end
54
+
55
+ def to_param
56
+ return @id
57
+ end
58
+
52
59
  end
53
60
  end
@@ -12,8 +12,15 @@ module ActsAsFerret #:nodoc:
12
12
  default_fields = indexes.inject([]) do |fields, idx|
13
13
  fields + [ idx.index_definition[:ferret][:default_field] ]
14
14
  end.flatten.uniq
15
+ # Patch to pass an or_default setting on to ferret.
16
+ # Without an or_default set, ferret will use OR queries by default.
17
+ # This implementation will use OR if any model asks for OR, otherwise
18
+ # AND. -- Paul Fitzpatrick, 11/1/2010 (contributed to public domain)
19
+ or_default =
20
+ indexes.select{|idx| idx.index_definition[:ferret][:or_default]}.size>0
15
21
  @options = {
16
- :default_field => default_fields
22
+ :default_field => default_fields,
23
+ :or_default => or_default
17
24
  }.update(options)
18
25
  @logger = IndexLogger.new(ActsAsFerret::logger, "multi: #{indexes.map(&:index_name).join(',')}")
19
26
  end
@@ -3,7 +3,6 @@ module ActsAsFerret
3
3
  # decorator that adds a total_hits accessor and will_paginate compatible
4
4
  # paging support to search result arrays
5
5
  class SearchResults < ActsAsFerret::BlankSlate
6
- reveal :methods
7
6
  attr_reader :current_page, :per_page, :total_hits, :total_pages
8
7
  alias total_entries total_hits # will_paginate compatibility
9
8
  alias page_count total_pages # will_paginate backwards compatibility
@@ -1,3 +1,3 @@
1
1
  module ActsAsFerret
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
3
3
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_ferret
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 5
9
- - 2
10
- version: 0.5.2
8
+ - 3
9
+ version: 0.5.3
11
10
  platform: ruby
12
11
  authors:
13
12
  - Jens Kraemer
@@ -15,18 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-10-26 00:00:00 +02:00
17
+ date: 2011-09-08 00:00:00 +02:00
19
18
  default_executable: aaf_install
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: jk-ferret
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
25
  - - ">="
28
26
  - !ruby/object:Gem::Version
29
- hash: 35
30
27
  segments:
31
28
  - 0
32
29
  - 11
@@ -38,11 +35,9 @@ dependencies:
38
35
  name: rails
39
36
  prerelease: false
40
37
  requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
39
  - - ">="
44
40
  - !ruby/object:Gem::Version
45
- hash: 7
46
41
  segments:
47
42
  - 3
48
43
  - 0
@@ -63,12 +58,14 @@ files:
63
58
  - LICENSE
64
59
  - bin/aaf_install
65
60
  - config/ferret_server.yml
61
+ - doc/demo/Gemfile
66
62
  - doc/demo/README
67
63
  - doc/demo/README_DEMO
68
64
  - doc/demo/Rakefile
69
65
  - doc/demo/app/controllers/admin/backend_controller.rb
70
66
  - doc/demo/app/controllers/admin_area_controller.rb
71
67
  - doc/demo/app/controllers/application.rb
68
+ - doc/demo/app/controllers/application_controller.rb
72
69
  - doc/demo/app/controllers/contents_controller.rb
73
70
  - doc/demo/app/controllers/searches_controller.rb
74
71
  - doc/demo/app/helpers/admin/backend_helper.rb
@@ -92,6 +89,7 @@ files:
92
89
  - doc/demo/app/views/layouts/application.html.erb
93
90
  - doc/demo/app/views/searches/_content.html.erb
94
91
  - doc/demo/app/views/searches/search.html.erb
92
+ - doc/demo/config/application.rb
95
93
  - doc/demo/config/boot.rb
96
94
  - doc/demo/config/database.yml
97
95
  - doc/demo/config/environment.rb
@@ -99,8 +97,15 @@ files:
99
97
  - doc/demo/config/environments/production.rb
100
98
  - doc/demo/config/environments/test.rb
101
99
  - doc/demo/config/ferret_server.yml
100
+ - doc/demo/config/initializers/backtrace_silencers.rb
101
+ - doc/demo/config/initializers/inflections.rb
102
+ - doc/demo/config/initializers/mime_types.rb
103
+ - doc/demo/config/initializers/secret_token.rb
104
+ - doc/demo/config/initializers/session_store.rb
102
105
  - doc/demo/config/lighttpd.conf
106
+ - doc/demo/config/locales/en.yml
103
107
  - doc/demo/config/routes.rb
108
+ - doc/demo/config.ru
104
109
  - doc/demo/db/development_structure.sql
105
110
  - doc/demo/db/migrate/001_initial_migration.rb
106
111
  - doc/demo/db/migrate/002_add_type_to_contents.rb
@@ -113,6 +118,7 @@ files:
113
118
  - doc/demo/doc/README_FOR_APP
114
119
  - doc/demo/doc/howto.txt
115
120
  - doc/demo/public/404.html
121
+ - doc/demo/public/422.html
116
122
  - doc/demo/public/500.html
117
123
  - doc/demo/public/dispatch.cgi
118
124
  - doc/demo/public/dispatch.fcgi
@@ -120,6 +126,12 @@ files:
120
126
  - doc/demo/public/favicon.ico
121
127
  - doc/demo/public/images/rails.png
122
128
  - doc/demo/public/index.html
129
+ - doc/demo/public/javascripts/application.js
130
+ - doc/demo/public/javascripts/controls.js
131
+ - doc/demo/public/javascripts/dragdrop.js
132
+ - doc/demo/public/javascripts/effects.js
133
+ - doc/demo/public/javascripts/prototype.js
134
+ - doc/demo/public/javascripts/rails.js
123
135
  - doc/demo/public/robots.txt
124
136
  - doc/demo/public/stylesheets/scaffold.css
125
137
  - doc/demo/script/about
@@ -135,16 +147,17 @@ files:
135
147
  - doc/demo/script/process/reaper
136
148
  - doc/demo/script/process/spawner
137
149
  - doc/demo/script/process/spinner
150
+ - doc/demo/script/rails
138
151
  - doc/demo/script/runner
139
152
  - doc/demo/script/server
140
153
  - doc/demo/test/fixtures/comments.yml
141
154
  - doc/demo/test/fixtures/contents.yml
142
- - doc/demo/test/fixtures/remote_contents.yml
143
155
  - doc/demo/test/fixtures/shared_index1s.yml
144
156
  - doc/demo/test/fixtures/shared_index2s.yml
145
157
  - doc/demo/test/functional/admin/backend_controller_test.rb
146
158
  - doc/demo/test/functional/contents_controller_test.rb
147
159
  - doc/demo/test/functional/searches_controller_test.rb
160
+ - doc/demo/test/performance/browsing_test.rb
148
161
  - doc/demo/test/smoke/drb_smoke_test.rb
149
162
  - doc/demo/test/smoke/process_stats.rb
150
163
  - doc/demo/test/test_helper.rb
@@ -157,36 +170,6 @@ files:
157
170
  - doc/demo/test/unit/shared_index2_test.rb
158
171
  - doc/demo/test/unit/sort_test.rb
159
172
  - doc/demo/test/unit/special_content_test.rb
160
- - doc/demo/vendor/plugins/will_paginate/LICENSE
161
- - doc/demo/vendor/plugins/will_paginate/README
162
- - doc/demo/vendor/plugins/will_paginate/Rakefile
163
- - doc/demo/vendor/plugins/will_paginate/init.rb
164
- - doc/demo/vendor/plugins/will_paginate/lib/will_paginate/collection.rb
165
- - doc/demo/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb
166
- - doc/demo/vendor/plugins/will_paginate/lib/will_paginate/finder.rb
167
- - doc/demo/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb
168
- - doc/demo/vendor/plugins/will_paginate/test/array_pagination_test.rb
169
- - doc/demo/vendor/plugins/will_paginate/test/boot.rb
170
- - doc/demo/vendor/plugins/will_paginate/test/console
171
- - doc/demo/vendor/plugins/will_paginate/test/finder_test.rb
172
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/admin.rb
173
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/companies.yml
174
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/company.rb
175
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/developer.rb
176
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml
177
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/project.rb
178
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/projects.yml
179
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/replies.yml
180
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/reply.rb
181
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/schema.sql
182
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/topic.rb
183
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/topics.yml
184
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/user.rb
185
- - doc/demo/vendor/plugins/will_paginate/test/fixtures/users.yml
186
- - doc/demo/vendor/plugins/will_paginate/test/helper.rb
187
- - doc/demo/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb
188
- - doc/demo/vendor/plugins/will_paginate/test/lib/load_fixtures.rb
189
- - doc/demo/vendor/plugins/will_paginate/test/pagination_test.rb
190
173
  - doc/monit-example
191
174
  - recipes/aaf_recipes.rb
192
175
  - script/ferret_server
@@ -229,29 +212,25 @@ rdoc_options:
229
212
  require_paths:
230
213
  - lib
231
214
  required_ruby_version: !ruby/object:Gem::Requirement
232
- none: false
233
215
  requirements:
234
216
  - - ">="
235
217
  - !ruby/object:Gem::Version
236
- hash: 57
237
218
  segments:
238
219
  - 1
239
220
  - 8
240
221
  - 7
241
222
  version: 1.8.7
242
223
  required_rubygems_version: !ruby/object:Gem::Requirement
243
- none: false
244
224
  requirements:
245
225
  - - ">="
246
226
  - !ruby/object:Gem::Version
247
- hash: 3
248
227
  segments:
249
228
  - 0
250
229
  version: "0"
251
230
  requirements: []
252
231
 
253
232
  rubyforge_project: acts_as_ferret
254
- rubygems_version: 1.3.7
233
+ rubygems_version: 1.3.6
255
234
  signing_key:
256
235
  specification_version: 3
257
236
  summary: acts_as_ferret - Ferret based full text search for any ActiveRecord model
@@ -1,9 +0,0 @@
1
- # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
- first:
3
- id: 1
4
- title: title of item one
5
- content: content of item one
6
- another:
7
- id: 2
8
- title: title of item two
9
- content: content of item two
@@ -1,18 +0,0 @@
1
- Copyright (c) 2007 PJ Hyett and Mislav Marohnić
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in
5
- the Software without restriction, including without limitation the rights to
6
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
- the Software, and to permit persons to whom the Software is furnished to do so,
8
- subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,108 +0,0 @@
1
- = WillPaginate
2
-
3
- Quick quiz: Where does pagination logic belong?
4
-
5
- a) in the model;
6
- b) in the controller;
7
- c) in views;
8
- d) all of the above.
9
-
10
- We think you know the answer (if you think hard enough).
11
-
12
- This plugin makes magic happen. You *will* paginate!
13
-
14
-
15
- == Example usage:
16
-
17
- Use a paginate finder in the controller:
18
-
19
- @posts = Post.paginate_by_board_id @board.id, :page => params[:page]
20
-
21
- Yeah, +paginate+ works just like +find+ -- it just doesn't fetch all the records.
22
- Just don't forget to tell it which page you want!
23
-
24
- Render the posts in your view like you would normally do. When you need to render
25
- pagination, just stick this in:
26
-
27
- <%= will_paginate @posts %>
28
-
29
- You're done. (Copy and paste the example fancy CSS styles from the bottom.)
30
-
31
- How does it know how much items to fetch per page? It asks your model by calling
32
- +Post.per_page+. You can define it like this:
33
-
34
- class Post < ActiveRecord::Base
35
- cattr_reader :per_page
36
- @@per_page = 50
37
- end
38
-
39
- ... or like this:
40
-
41
- class Post < ActiveRecord::Base
42
- def self.per_page
43
- 50
44
- end
45
- end
46
-
47
- ... or don't worry about it at all. (WillPaginate defines it to be 30 if missing.)
48
- You can also specify the count explicitly when calling +paginate+:
49
-
50
- @posts = Post.paginate :page => params[:page], :per_page => 50
51
-
52
- The +paginate+ finder wraps the original finder and returns your resultset that now has
53
- some new properties. You can use the collection as you would with any ActiveRecord
54
- resultset, but WillPaginate view helpers also need that object to be able to render pagination:
55
-
56
- <ol>
57
- <% for post in @posts -%>
58
- <li>Render `post` in some nice way.</li>
59
- <% end -%>
60
- </ol>
61
-
62
- <p>Now let's render us some pagination!</p>
63
- <%= will_paginate @posts %>
64
-
65
-
66
- == Authors, credits
67
-
68
- Ruby port by: PJ Hyett, Mislav Marohnić (Sulien)
69
- Contributors: K. Adam Christensen, Chris Wanstrath, Dr. Nic Williams
70
- Original announcement: http://errtheblog.com/post/929
71
- Original PHP source: http://www.strangerstudios.com/sandbox/pagination/diggstyle.php
72
-
73
- REPORT BUGS on Lighthouse: http://err.lighthouseapp.com/projects/466-plugins/overview
74
-
75
-
76
- == Want Digg style?
77
-
78
- Copy the following css into your stylesheet for a good start:
79
-
80
- .pagination {
81
- padding: 3px;
82
- margin: 3px;
83
- }
84
- .pagination a {
85
- padding: 2px 5px 2px 5px;
86
- margin: 2px;
87
- border: 1px solid #aaaadd;
88
- text-decoration: none;
89
- color: #000099;
90
- }
91
- .pagination a:hover, .pagination a:active {
92
- border: 1px solid #000099;
93
- color: #000;
94
- }
95
- .pagination span.current {
96
- padding: 2px 5px 2px 5px;
97
- margin: 2px;
98
- border: 1px solid #000099;
99
- font-weight: bold;
100
- background-color: #000099;
101
- color: #FFF;
102
- }
103
- .pagination span.disabled {
104
- padding: 2px 5px 2px 5px;
105
- margin: 2px;
106
- border: 1px solid #eee;
107
- color: #ddd;
108
- }