markgandolfo / find_list
- Source
- Commits
- Network (2)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
cb68edb
commit cb68edb5e953b75c0807f73c17a29671574062de
tree ee154f983532e0a94dfe51466a9c91bb6ca210a6
parent 80a16ce6ff495bffd73303fd7b323798a291f9c6
tree ee154f983532e0a94dfe51466a9c91bb6ca210a6
parent 80a16ce6ff495bffd73303fd7b323798a291f9c6
find_list / 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
