Sitelet https://github.com/adzap/validates_timeliness/pull/232
Skip to content

ensure options on validations are passed into errors - #232

Open
JoshDevs wants to merge 1 commit into
adzap:masterfrom
Ophelos:josh/pass-options-through-to-errors
Open

JoshDevs wants to merge 1 commit into
adzap:masterfrom
Ophelos:josh/pass-options-through-to-errors

Conversation

@JoshDevs

Copy link
Copy Markdown

This PR ensures that the options that are sent in the validation are passed through to errors.

Custom options being set on a validation should be able to be accessed post validation as they would have been set to indicate a validation has failed for some reason.

Added a test case that checks for this.

@TastyPi

TastyPi commented Jun 22, 2023

Copy link
Copy Markdown
Contributor

@adzap Hi, this is a minor patch we've made to validates_timeliness. It makes the library more consistent with the standard Rails validators, as they all include **options when adding an error, e.g. PresenceValidator.

We'd like to get this merged upstream so we don't have to maintain our own fork, could you take a look?

@tagliala

tagliala commented Jan 4, 2024

Copy link
Copy Markdown
Contributor

Hi, I've asked to be added to maintainers so I can keep this library up to date and merge bug fixes like this. Let's maybe wait but at a certain point I'm interested in creating a fork maybe in a new GitHub team to allow multiple admins

@TastyPi

TastyPi commented Jul 29, 2024

Copy link
Copy Markdown
Contributor

@tagliala any update on this?

@tagliala

Copy link
Copy Markdown
Contributor

Please migrate to Rails' built in comparison validator, this gem is not maintained and probably not needed anymore

diowa/icare@dd4a467#diff-8f06df7d19040b42d0ab94249895f10fac375834ce5a6f4e55b93570b9dd7d8fL26-R27

@TastyPi

TastyPi commented Jul 30, 2024

Copy link
Copy Markdown
Contributor

@tagliala we use this gem to check that the correct date format was provided in order to prevent mm-dd-yyyy vs dd-mm-yyyy issues from data we get from clients. We probably don't need to anymore, but that is a use case the Rails validators do not provide. Admittedly it doesn't guarantee we were provided with the right format e.g. 01-02-2024 is ambiguous, but it was an extra feature this gem has that Rails doesn't.

@adzap

adzap commented Nov 30, 2024

Copy link
Copy Markdown
Owner

Seems like the convention is to filter out the validation option keys. The presence validator has no option keys so is it the best example. Will work on this.

@adzap

adzap commented Nov 30, 2024

Copy link
Copy Markdown
Owner

checkout c3c4459

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants