Last active
April 1, 2021 10:47
-
-
Save spencerldixon/9739184f57ecef016be2809b36affd7b to your computer and use it in GitHub Desktop.
Overrides the year field of a date_select if it is not set
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
def update_params | |
params.require(:thing).permit(:date).tap do |param| | |
param["date(1i)"] = Date.current.year if param["date(1i)"] == "1" | |
# Can merge in other things here | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment