Project

with_order

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Add ordering to lists, tables, etc.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.1
 Project Readme

with_order

Provide ordering for tables, lists, etc.

This project follows Semantic Versioning.

Installation

$ gem install with_order

If you're using Bundler, add this to your Gemfile:

gem 'with_order', '~>0.1.0'

Support

Ruby 1.9
Rails 3.1
Database Framework ActiveRecord

Usage

In your controller:

@data = Data.with_order(params, default: :full_name, fields: {full_name: 'first_name ASC, last_name ASC'})

In your view:

<th><%= link_with_order('ID', @data, :id) %></th>
<th><%= link_with_order('Full Name', @data, :full_name) %></th>
<th><%= link_with_order('Email', @data, :email) %></th>