-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Confirmable API #3412
Comments
Thanks. I don't think we use save! anywhere though, do we? The issue is that using |
There is only one other method where validations are run and the method is a bang: https://github.com/plataformatec/devise/blob/master/lib/devise/models/recoverable.rb#L42 so we might rename |
Agreed, that would be best! Thanks for looking into this! |
Btw, can you please submit a pull request? :) |
I've submitted a PR (#3570). Also I have a bit of a problem with compatiblity with NoBrainer and the adapter devise-nobrainer The AR equivalent in NoBrainer of There are two places
Side node: there are 13 places where save is called without performing validations (that seems a bit odd, but whatever). So to make NoBrainer compatible with devise, I make these two
What do you think we should do? |
Before closing, can you address my latest comment? |
I could swear I had written a reply, sorry. I don't think we should change Devise due to an ORM. The only short-term option I have in mind right now is to pass The long-term option is to improve orm_adapter (I am a maintainer) to have a save function so we could do |
going with the So let's do the |
Please do send a PR! José Valimwww.plataformatec.com.br |
Done: |
ping :) |
Nevermind, I no longer need the |
Hi @josevalim,
As I was looking at the
confirm!
method in confirmable: https://github.com/plataformatec/devise/blob/85238014593443fb66cd0b1387f7ec8103f0fb91/lib/devise/models/confirmable.rb#L59-L84And find the API a bit odd.
confirm!
expects users to check for its return value, true or false, to detect possible errors.This might not be a reasonable assumption. The name of the method implies that it would raise, similarly to the
save
vssave!
behavior.Here's some data to backup my claims:
So I'd say that
confirm!
should usesave!
instead of returning true/false. Or be renamed to justconfirm?
, ortry_confirm
, to make it explicit to the user should check for the return value.What do you think?
Side note: I have personal interest to go with the
save!
route, because NoBrainer'ssave!
method has the same semantics as other ORMs, unlikesave
which behaves likesave!
.The text was updated successfully, but these errors were encountered: