I could you some assistance formatting a date field in a drop-down list in a for in a view. My dates are showing with a time-stamp and I\'d like them to show as \"mm/dd/yyy
In your model add the following method
def event_date_formatted
event_date.strftime("%m/%d/%Y")
end
Then you can simply use like so:
<%= select_tag "event_date", options_from_collection_for_select(UgradRsvp.get_event_dates, 'event_date', :event_date_formatted) %>
I not try yet, but you can try to add method to Model like
class UgradRsvp < ActiveRecord::Base
def event_date_text
event_date.strftime("%d/%m/%Y")
end
end
and then call event_date_text as txt_method
<%= select_tag "event_date", options_from_collection_for_select(UgradRsvp.get_event_dates, "event_date", "event_date_text") %>