Created
May 30, 2021 04:19
-
-
Save koheisg/df64b6f7fbded2d1bbbe35e5c591599a to your computer and use it in GitHub Desktop.
Select less than the day after the input date by ransack to avoid not include the value of input date.
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
.field | |
= f.label :created_at | |
= f.date_field :created_at_gteq, class: 'datepicker' | |
〜 | |
= f.date_field :created_at_lt_next_day, class: 'datepicker' |
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
Ransack.configure do |config| | |
config.add_predicate 'lt_next_day', | |
arel_predicate: 'lt', | |
formatter: proc {|v| v.tomorrow.beginning_of_day}, | |
compounds: false | |
end |
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
Model Load (1.8ms) SELECT `models`.* FROM `models` WHERE (`models`.`created_at` < '2021-06-01 00:00:00') LIMIT 100 OFFSET 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment