Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Provide ordering for tables, lists, etc.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 changelog.markdown
Octocat-spinner-32 with_order.gemspec
README.markdown

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>
Something went wrong with that request. Please try again.