Skip to content

Instantly share code, notes, and snippets.

@davetapley
Last active February 13, 2016 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davetapley/521bc7357f42a056af3c to your computer and use it in GitHub Desktop.
Save davetapley/521bc7357f42a056af3c to your computer and use it in GitHub Desktop.
ActiveSupport::Duration in select
>> @store.start_of_day == 0.hours
=> true
>> options_for_select([['foo', 0.hours]], @store.start_of_day)
=> "<option value=\"0\">foo</option>"
>> options_for_select([['foo', 0.hours]], 0.hours)
=> "<option selected=\"selected\" value=\"0\">foo</option>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment