Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

chaged introductions

  • Loading branch information...
commit d1b82c687ed83e92868ce363016f4c7ffd0d593e 1 parent 26c83b0
@Aaron2Ti authored
Showing with 14 additions and 9 deletions.
  1. +14 −9 README
View
23 README
@@ -6,16 +6,21 @@
RecordsSequence
=============
- This plugin adds 'next/previous' to every ActiveRecord objects. Using it you could find next/previous object even accroding your requirements
+ This plugin adds 'next/previous' methods to every ActiveRecord object.
+ Using it you could easily find next/previous object accroding your requirements.
+
INSTALL
============
This plugin requires Rails 2.1 currently. Install easily by below command:
ruby script/plugin install git://github.com/Aaron2Ti/records_sequence.git
+
USAGE
-=======
-After installed, this plugin would mixin two methods(next and previous) to every ActiveRecord object. So it's cool to do:
+============
+After installed, this plugin would mixin two methods(next and previous) to
+every ActiveRecord object. So it's cool to do:
+
class User < ActiveRecord::Base
end
@@ -23,21 +28,21 @@ After installed, this plugin would mixin two methods(next and previous) to every
bar = foo.next
foo_neighbour = foo.previous # returns nil if foo has no previous neighbour
-The sequence's sorted column is defined by the new option :sorted_by, default is the 'id' column.
+ # The sequence's sorted column is defined by the new option :sorted_by,
+ # which default is the 'id' column.
foo = User.last
pre_foo_sorted_by_id = foo.previous
pre_foo_sorted_by_age = foo.previous(:sorted_by => 'age')
-Also works fine with most other ActiveRecord's find options:
+ # Also works fine with most other ActiveRecord's find options:
foo = User.find 30
foo.next(:conditions => ['age < ?', 20])
foo.previous(:offset => 2)
- foo.next(:sorted_by => 'age', :order => 'name DESC, age')
+ foo.next(:sorted_by => 'address', :order => 'name DESC, age')
foo.previous( :sorted_by => 'age', :conditions => ['age < ?', 20],
- :order => 'name DESC, age', :offset => 2 )
-
-Please Try Yourself!
+ :order => 'name DESC, address', :offset => 2 )
+Try Yourself!
Copyright (c) 2008 [Aaron Tian Email: Aaron2Ti@gmail.com],
released under the MIT license
Please sign in to comment.
Something went wrong with that request. Please try again.