Created
October 15, 2008 18:49
-
-
Save grobie/16976 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Customer | |
def self.options_for_select | |
all.collect do |customer| | |
[customer.formatted_for_option, customer.id] | |
end | |
end | |
def formatted_for_option | |
"#{id}: #{title}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% form_for :invoice do |form| %> | |
<%= form.select(:customer_id, Customer.options_for_select) %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment