Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save spencerldixon/9739184f57ecef016be2809b36affd7b to your computer and use it in GitHub Desktop.
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
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