Last active
October 15, 2016 11:33
-
-
Save notapatch/3890201 to your computer and use it in GitHub Desktop.
Passing a DateTime Parameter into a controller action
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
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