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 for Deprecation warning in Rails 6.0.0 #35

Merged
merged 2 commits into from
Oct 9, 2019

Conversation

mgmodell
Copy link
Contributor

@mgmodell mgmodell commented Oct 1, 2019

This addresses #34 .

@allenwq
Copy link
Owner

allenwq commented Oct 3, 2019

@mgmodell Thanks for your contribution, let me see if I can fix the build with latest rails.

@mgmodell
Copy link
Contributor Author

mgmodell commented Oct 3, 2019

Thanks, @allenwq . Is this broken build due to my patch? Should I have found this on my own?

@allenwq
Copy link
Owner

allenwq commented Oct 3, 2019 via email

@allenwq
Copy link
Owner

allenwq commented Oct 7, 2019

@mgmodell Try to rebase and push again?

@mgmodell
Copy link
Contributor Author

mgmodell commented Oct 7, 2019

I've never done this before, so I just hope I'm doing it right. I pulled your latest into my repo and then pushed back the results. Github doesn't seem to be unhappy with this so far. Was that right?

Copy link
Owner

@allenwq allenwq left a comment

Choose a reason for hiding this comment

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

@mgmodell Looks about right, I have given some comments. Thanks for your contribution!

validates_uniqueness_of :email, allow_blank: true, case_sensitive: true, if: :will_save_change_to_email?
validates_format_of :email, with: email_regexp, allow_blank: true, if: :will_save_change_to_email?
else
validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
Copy link
Owner

Choose a reason for hiding this comment

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

Sorry I haven't worked on Rails for a while, can you tell me why case_sensitive is removed? Did rails6 make this the default?

Copy link
Owner

Choose a reason for hiding this comment

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

Also why will_save_change_to_email is changed to email_changed?, some comments might be helpful.

Copy link
Contributor Author

@mgmodell mgmodell Oct 7, 2019

Choose a reason for hiding this comment

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

It appears that case_sensitive is being deprecated and will be removed in rails 6.1. As for switching will_save_change_to_email moving to email_changed ⎯ I'm not really sure. When I went looking for an answer, I found this code in sister code devise issue 5064 and figured that if it's the direction they are taking, it's probably representative of best practices for us.

Is this sufficient for comments, or would you like me to add them in the code itself (which I find quite readable without)?

@allenwq allenwq merged commit 4ddae95 into allenwq:master Oct 9, 2019
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