Skip to content

Instantly share code, notes, and snippets.

@notapatch
Last active October 15, 2016 11:33
Show Gist options
  • Save notapatch/3890201 to your computer and use it in GitHub Desktop.
Save notapatch/3890201 to your computer and use it in GitHub Desktop.
Passing a DateTime Parameter into a controller action
Adding datetime parameter to a URL
<%= link_to 'This Week', appointments_path(begin: DateTime.now.beginning_of_week) %>
Testing for the parameter
- if params.has_key?(:begin)
Parsing the parameter
- Time.parse(params[:begin])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment