Return to Snippet

Revision: 1085
at September 7, 2006 17:08 by jnunemaker


Initial Code
module ActiveRecord
  class Base  
    def self.to_select(conditions = nil)
      find(:all).collect { |x| [x.name,x.id] }
    end
  end
end

class Array
  def to_select
    self.collect { |x| [x.name,x.id] }
  end
end

Initial URL

                                

Initial Description

                                

Initial Title
Easy Selects in Ruby on Rails

Initial Tags
sql, html, rails, ruby

Initial Language
Other