Last active
March 16, 2022 12:18
-
-
Save pama/ea8774d10d9efb61ddd745fa93c637d2 to your computer and use it in GitHub Desktop.
Search example using query chain
This file contains hidden or 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
# build a form that posts a document (or whatever) and the form must have the starts_at and ends_at attributes | |
# you might need to adjust the attributes | |
@documents = Document.all | |
# if we have the params | |
@documents = @document.where(referenced_at: params[:document][:starts_at]..params[:document][:ends_at]) if ..... |
This file contains hidden or 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
<!-- https://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-date_select --> | |
<%= form_tag documents_path %> | |
<label>from</label> | |
<%= date_select :document, :starts_at %> | |
<label>to</label> | |
<%= date_select :document, :endts_at %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment