Skip to content

Instantly share code, notes, and snippets.

@lantins
Created July 16, 2009 02:48
Show Gist options
  • Select an option

  • Save lantins/148124 to your computer and use it in GitHub Desktop.

Select an option

Save lantins/148124 to your computer and use it in GitHub Desktop.
works in 1.8 but not 1.9?
def self.all_for_select(customer = nil)
vehicles = self.filter(:customer_id => customer.id)
select_options = [nil => "-- VEHICLE SELECTION --"]
vehicles.each do |vehicle|
select_options << {vehicle.serial_number, vehicle.name}
end
return select_options
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment