
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
= guilded
http://github.com/midas/sort_it_out
== DESCRIPTION
Easily add sorting functionality to your Rails controller actions in a clean manner.
== FEATURES
== REQUIREMENTS
== INSTALL
gem sources -a http://gemcutter.org sudo gem install sort_it_out
== USAGE
Add to the Rails environment file:
config.gem "sort_it_out", :source => 'http://gemcutter.org'
Simplest case:
class UsersController< ApplicationController sortable
def index
User.find( :all, :order => @order ) # @order is set up by sort_it_out
...
end
end
In the previous example a before filter is run that will set up an @order variable containing a SQL fragment for the order clause. The order clause will be set up from the parameters :order and :direction.
Include a default sort direction:
class UsersController< ApplicationController sortable :default => { :attribute => :name, :direction => 'DESC' }
def index User.find( :all, :order => @order ) # @order is set up by sort_it_out ... end end
More complex case:
class UsersController< ApplicationController sortable :default => :name, :map => { :name => [:name_last, :name_first, :name_middle] }
def index
User.find( :all, :order => @order ) # @order is set up by sort_it_out
...
end
end
In the previous example a default field to sort by is configured. Thus, if there is no :order param, the default field is used. There is also a map set up. If the :order param is :name, then the order clause will be built using the name_last, name_first and name_middle fields.
== LICENSE
Copyright (c) 2009 C. Jason Harrelson (midas)
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Unknown package
We found that sort_it_out demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.