-
Notifications
You must be signed in to change notification settings - Fork 637
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
Introduces instance level skip validation option. #644
Introduces instance level skip validation option. #644
Conversation
d1b1628
to
bcf9183
Compare
@anilmaurya please have a look at this PR, check if this functionality can be merged. |
README.md
Outdated
@@ -739,6 +739,13 @@ class Job < ActiveRecord::Base | |||
end | |||
``` | |||
|
|||
Also You can skip the validation at instance level with `some_event_name_without_validation!` method. | |||
With this you have the flexibility of having validation for all your transitions by default and then skip it wherever required. | |||
Please not that only update column will be updated as mentioned in the above example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please not that only update column will be updated as mentioned in the above example. | |
Please note that only state column will be updated as mentioned in the above example. |
expect(example.state).to eq('complete') | ||
end | ||
|
||
it 'shouldn\'t affect the behaviour of existing method after calling _without_validation method' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it 'shouldn\'t affect the behaviour of existing method after calling _without_validation method' do | |
it 'shouldn't affect the behaviour of existing method after calling _without_validation! method' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anilmaurya backslash was intentional to escape the single quote.
README.md
Outdated
With this you have the flexibility of having validation for all your transitions by default and then skip it wherever required. | ||
Please not that only update column will be updated as mentioned in the above example. | ||
<br/> | ||
<br/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<br/> |
README.md
Outdated
With this you have the flexibility of having validation for all your transitions by default and then skip it wherever required. | ||
Please not that only update column will be updated as mentioned in the above example. | ||
<br/> | ||
<br/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<br/> |
Hi @Nitin-Salunke , Thank you for your contribution and patience. |
bcf9183
to
a024ba8
Compare
@anilmaurya I have done the changes suggested by you, please have a look. |
ad95c86
to
0404e3e
Compare
@Nitin-Salunke PR looks good but travis build is failing for some reason. |
No brainer one is failing with the connection refused error. |
@anilmaurya yes sure. |
6d5b0d7
to
d5dcedb
Compare
d5dcedb
to
305c2be
Compare
Code Climate has analyzed commit 305c2be and detected 0 issues on this pull request. View more on Code Climate. |
@anilmaurya please merge the PR. |
Codecov Report
@@ Coverage Diff @@
## master #644 +/- ##
==========================================
+ Coverage 95.14% 95.17% +0.03%
==========================================
Files 35 35
Lines 1214 1223 +9
==========================================
+ Hits 1155 1164 +9
Misses 59 59
Continue to review full report at Codecov.
|
@Nitin-Salunke Thank you for your contribution. ⚡️ |
Released |
We had a specific requirement to skip validations for transitions at the instance level at a few places but at the same time, we wanted the transitions for the model to validated at other places.
The change in this PR just adds a method like
some_event_name_without_validation!
which actually skips the validation and set the object state according to the transitions defined.