Skip to content

Commit

Permalink
Added default per_page option
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Sep 7, 2008
1 parent f53b39f commit dc35d0e
Show file tree
Hide file tree
Showing 56 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/environments/development.rb
Expand Up @@ -17,4 +17,4 @@
config.action_mailer.raise_delivery_errors = false

config.plugin_paths += ["../../Ruby Libs"]
config.plugins = [:calendar_date_select, :searchgasm]
config.plugins = ["calendar_date_select", "searchgasm-0.9.8"]
5 changes: 5 additions & 0 deletions config/initializers/searchgasm.rb
@@ -1,3 +1,8 @@
# Confugration
Searchgasm::Config.configure do |config|
config.per_page = config.per_page_choices.first # 20
end

# Actual function for MySQL databases only
class SoundsLikeCondition < Searchgasm::Condition::Base
class << self
Expand Down
@@ -1,3 +1,5 @@
v0.9.8. Fixed order_by helper bug when determing the text with arrays. Should use the first value instead of last. Added in per_page config option.

v0.9.7. Complete class restructure, much more organized, added in documentation, added in helpers for using searchgasm in a rails app, updated readme with link to documentation as well as a live example, some bug fixes, more tests

v0.9.6. Fix bug when instantiating with nil options
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -11,7 +11,8 @@ I'm a big fan of understanding what I'm using, so here's a quick explanation: Th
== Quicklinks

* <b>Documentation:</b> http://searchgasm.rubyforge.org
* <b>Live rails example:</b> http://searchgasm_example.binarylogic.com
* <b>Easy pagination, ordering, and searching tutorial:</b> http://www.binarylogic.com/2008/9/7/tutorial-pagination-ordering-and-searching-with-searchgasm
* <b>The tutorial above, live:</b> http://searchgasm_example.binarylogic.com

== Install and use

Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -55,6 +55,18 @@ def pages_type=(value)
@pages_type = value.to_sym
end

def per_page # :nodoc:
@per_page
end

# The default for per page.
#
# * <tt>Default:</tt> nil, nil means "show all"
# * <tt>Accepts:</tt> Any value in your per_page choices
def per_page=(value)
@per_page = value
end

def per_page_choices # :nodoc:
@per_page_choices ||= [10, 25, 50, 100, 150, 200, nil]
end
Expand Down
Expand Up @@ -49,6 +49,10 @@ def inspect
"#<#{klass} #{options_as_nice_string}>"
end

def limit
@limit ||= Config.per_page
end

def limit=(value)
@limit = value.blank? || value == 0 ? nil : value.to_i
end
Expand Down
Expand Up @@ -67,7 +67,7 @@ def to_a

MAJOR = 0
MINOR = 9
TINY = 7
TINY = 8

# The current version as a Version instance
CURRENT = new(MAJOR, MINOR, TINY)
Expand Down
@@ -1,18 +1,18 @@

# Gem::Specification for Searchgasm-0.9.7
# Gem::Specification for Searchgasm-0.9.8
# Originally generated by Echoe

--- !ruby/object:Gem::Specification
name: searchgasm
version: !ruby/object:Gem::Version
version: 0.9.7
version: 0.9.8
platform: ruby
authors:
- Ben Johnson of Binary Logic
autorequire:
bindir: bin

date: 2008-09-06 00:00:00 -04:00
date: 2008-09-07 00:00:00 -04:00
default_executable:
dependencies:
- !ruby/object:Gem::Dependency
Expand Down

0 comments on commit dc35d0e

Please sign in to comment.