Posted By

jnunemaker on 09/07/06


Tagged

sql html rails ruby tags pagination urls layouts routes typo


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

padraic
lfatr


Easy Selects in Ruby on Rails


 / Published in: Other
 

  1.  
  2. module ActiveRecord
  3. class Base
  4. def self.to_select(conditions = nil)
  5. find(:all).collect { |x| [x.name,x.id] }
  6. end
  7. end
  8. end
  9.  
  10. class Array
  11. def to_select
  12. self.collect { |x| [x.name,x.id] }
  13. end
  14. end
  15.  

Report this snippet  

You need to login to post a comment.