public
Description: Gets your ActiveRecord attributes in order to use them for csv exports or automated table generation. Attribute groups let you easily manage different orders.
Homepage: http://www.extjswithrails.com
Clone URL: git://github.com/steffen/ordered_attributes.git
commit  4e376cb1d7aaef0446690b78879679e166f76490
tree    4c70f38819799a34366bd8dc12a915d991701117
parent  93bad52fadc4fdd3d42f96e07e89500583d7b06a
name age message
file .gitignore Tue Apr 29 07:17:40 -0700 2008 Added feature that allows passing custom attrib... [Steffen Hiller]
file MIT-LICENSE Fri Apr 25 15:28:03 -0700 2008 Initial commit with files generated from script... [Steffen Hiller]
file README Thu May 01 09:42:28 -0700 2008 Sorry, changed repo url to be more consistent w... [steffen]
file Rakefile Fri Apr 25 15:28:03 -0700 2008 Initial commit with files generated from script... [Steffen Hiller]
file init.rb Tue Apr 29 07:33:19 -0700 2008 Forgot to change file name of lib in init file. [Steffen Hiller]
file install.rb Fri Apr 25 15:28:03 -0700 2008 Initial commit with files generated from script... [Steffen Hiller]
directory lib/ Tue Apr 29 08:54:46 -0700 2008 Added some tests. Also allowing now the passing... [steffen]
directory spec/ Tue Apr 29 08:54:46 -0700 2008 Added some tests. Also allowing now the passing... [steffen]
directory tasks/ Tue Apr 29 07:22:34 -0700 2008 Renamed plugin to Ordered Attributes [Steffen Hiller]
file uninstall.rb Fri Apr 25 15:28:03 -0700 2008 Initial commit with files generated from script... [Steffen Hiller]
README
Ordered Attributes
================

This Ruby on Rails plugin provides a way to order ActiveRecord attributes for using them for csv exports or automated 
table generation.


Installation
============

git clone git://github.com/steffen/ordered_attributes.git vendor/plugins/ordered_attributes

or if you are on edge rails

script/plugin install git://github.com/steffen/ordered_attributes.git


Example
=======

class Person < ActiveRecord::Base
  
  attr_order :name, :street, :zip, :city
  
  attr_groups :address => [:street, :zip, :city],
              :birth => [:date_of_birth, :place_of_birth], // you can use %w(date_of_birth place_of_birth) as well
              :all => [:name, :address, :birth]
  
end

Use the ordered_attributes method to get the ordered attributes:

Person.ordered_attributes
=> [:name, :street, :zip, :city]

Person.ordered_attributes(:all)
=> [:name, :street, :zip, :city, :date_of_birth, :place_of_birth]


See spec/ordered_attributes_spec.rb for more Examples!



Copyright (c) 2008 Steffen Hiller, released under the MIT license