public
Description: Find List is a ruby on rails plugin to return an array from activerecord in a format that f.select likes
Homepage: http://markgandolfo.com
Clone URL: git://github.com/markgandolfo/find_list.git
name age message
file .gitignore Wed Jun 03 17:49:51 -0700 2009 Update the Rakefile so the specs now run with r... [radar]
file MIT-LICENSE Sun May 31 00:24:13 -0700 2009 first commit [markgandolfo]
file README.markdown Sun May 31 00:24:13 -0700 2009 first commit [markgandolfo]
file Rakefile Wed Jun 03 17:49:52 -0700 2009 "rake test" will now run the specs as will "rak... [radar]
file init.rb Sun May 31 00:24:13 -0700 2009 first commit [markgandolfo]
file install.rb Sun May 31 00:24:13 -0700 2009 first commit [markgandolfo]
directory lib/ Sun May 31 01:42:30 -0700 2009 removed id from display field [markgandolfo]
directory spec/ Sun May 31 01:42:30 -0700 2009 removed id from display field [markgandolfo]
directory tasks/ Sun May 31 00:24:13 -0700 2009 first commit [markgandolfo]
file uninstall.rb Sun May 31 00:24:13 -0700 2009 first commit [markgandolfo]
README.markdown

FindByList

Little plugin that will return an array from an Active Record object ready to use in a select By default it uses the 'id' as the value and 'name' as the display field.

Example

To get all users User.list

If you want to select different fields for the list plugin to use, you can simply do

User.list(:id => 'another_id_field', :display => 'firstname')

Standard activerecord :conditions tags can also be used

User.list(:conditions => { :active => 1 } )

Or to put everything together

User.list(:id => 'another_id_field', :display => 'firstname', :conditions => { :active => 1 })

Copyright

Copyright (c) 2009 Mark Gandolfo, released under the MIT license