Project

arel-order

0.0
No commit activity in last 3 years
No release in over 3 years
Adds several methods which help to build ORDER BY statements.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1
~> 1.7
~> 12.0
~> 3.2

Runtime

>= 6.0
 Project Readme

Adds several methods which help to build ORDER BY statements.

Gem Version Build Status

About

Ă€rel::Attributes::Attribute receives several methods which help to build ORDER BY statements.

Usage

# Query posts: posts with category get bigger priority.
t = Post.arel_table
Post.order("(#{t[:category_id]} > 0), #{t[:position].order_asc}")
# SELECT * FROM `posts` ORDER BY (`posts`.`category_id` IS NOT NULL), `posts`.`position` ASC

Installing gem

Add to your Gemfile:

gem 'arel-order', '~> 1.0'

Running Tests

Install bundler:

gem install bundler

Install dependencies:

cd arel-order && bundle

Run tests:

cd arel-order && appraisal rake test