- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 592
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
Bypassing validations and strange behaviour #642
Comments
Thanks for such an outstanding bug report, and my apologies for taking so long to respond. I agree this should be fixed, and am looking into the best solution. In the mean time, this workaround would help in your application: class Project < ActiveRecord::Base
# Friendly Id
extend FriendlyId
friendly_id :name, :use => :slugged
# Validations
validates_presence_of :name, :description
after_validation :unset_slug_if_invalid
def unset_slug_if_invalid
if errors.present? && slug_changed?
self.slug = slug_was
end
true
end
end |
This issue is now resolved in master and will go out in gem version 5.2.0.beta.1 some time this week. |
This is now out in 5.2.0.beta.1. No timetable for stable release yet, but probably within a couple weeks. |
Awesome! Thank you. |
I've just stumbled onto this problem myself, is there an ETA for this fix to be released? Thank you! |
@rachel-carvalho Sorry I've been a bit slow to put out the new release, there were a few additional things I wanted to work on and never quite got to. I hope to put out a new release in a few weeks but I can't give your a hard date. In the mean time I'd suggest you try 5.2.0.beta.1, it's more stable than the release number might imply. |
I appreciate the fast reply! I'll give the beta version a try, is there any kind of change log, so I can know what to expect to act differently in this version? |
Hi Norman and others!
I'm facing a problem (bug maybe) when trying to save object which was created already with validation bypass
@project.save(validate: false)
. I've created demonstration app with test which fails but should pass in my opinion - https://github.com/alpracka/testfriendly. Here is also short screenrecord: http://n1dev.com/system/data/testfriendly.mov (3MB)The text was updated successfully, but these errors were encountered: