Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/form_fu.rb
Class Method Summary collapse
-
.to_select(method = 'to_s', conditions = nil) ⇒ Object
find all items matching condition, and return an array of [value,key], useful for using with select.
Class Method Details
.to_select(method = 'to_s', conditions = nil) ⇒ Object
find all items matching condition, and return an array of [value,key], useful for using with select
17 18 19 |
# File 'lib/form_fu.rb', line 17 def self.to_select(method='to_s', conditions=nil) find(:all, :conditions => conditions).collect{|record| [record.send(method), record.id]} end |