Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NoOverlapValidator #15

Merged
merged 1 commit into from
Apr 1, 2020
Merged

Fix NoOverlapValidator #15

merged 1 commit into from
Apr 1, 2020

Conversation

izzergh
Copy link
Contributor

@izzergh izzergh commented Apr 1, 2020

The fix is on line 38 of lib/no_overlap_validator.rb
The missing space between record.isntance_eval and &options... was causing an error when instance_eval was used.

Also adds specs that act as a health check for the instance_scope feature.

The fix is on line 38 of lib/no_overlap_validator.rb
The missing space between `record.isntance_eval` and `&options...` was
causing an error when instance_eval was used.

Also adds specs that act as a health check for the instance_scope
feature.
class NoOverlapValidator < ActiveModel::Validator
def validate(record)
overlapping_records = temporally_overlapping_for(record)
instance_scope = if options[:instance_scope].is_a? Proc
record.instance_eval&options[:instance_scope]
record.instance_eval(&options[:instance_scope])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, yeah I thought I pointed out the typo in the other PR but I guess not; a victim of the line length crusade :)

It'll be important to release a new version. I'd even say we should yank out the old one but I doubt many people would notice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is a patch for sure

@izzergh
Copy link
Contributor Author

izzergh commented Apr 1, 2020

Octo approved via gchat

@izzergh izzergh merged commit b3094ad into master Apr 1, 2020
@izzergh izzergh deleted the fix-no-overlap-validator branch April 1, 2020 12:58
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.

None yet

2 participants