This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
LICENSE | Tue Oct 21 09:25:04 -0700 2008 | |
| |
README.textile | Tue Oct 21 09:31:12 -0700 2008 | |
| |
init.rb | Tue Oct 21 09:25:04 -0700 2008 | |
| |
lib/ | Tue Oct 21 09:31:12 -0700 2008 | |
| |
test/ | Tue Oct 21 09:25:04 -0700 2008 |
README.textile
has-adjacent-finders
This plugin allows you to find rows adjacent to an arbitrary row by adding the following methods to ActiveRecord models:
- find_next_row - find record to the right of current record
- find_previous_row - find record to the left of current record
- find_next_rows - find records to the right of current record
- find_previous_rows - find records to the left of current record
- find_adjacent_rows - find records to the right and left of current record
***************************************************************************
Usage
class Product < ActiveRecord::Base
has_adjacent_finders
end
@product = Product.find(1)
@product.find_next_row
@product.find_previous_row
@product.find_adjacent_rows
Advanced usage
@product = Product.find(1)
@product.find_next_row({:conditions => "category_id = #{@product.category_id}"})
@product.find_previous_row({:conditions => "category_id = #{@product.category_id}"})
@product.find_adjacent_rows({:left => 2, :right => 3}, {:conditions => "category_id = #{@product.category_id}", :order => 'id', :include => :shop})







