-
-
Save radar/727695 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class YourModel < ActiveRecord::Base | |
| before_create :set_downcase_subdomain | |
| validates_uniqueness_of :subdomain | |
| # other validations, associations and other methods go here | |
| private | |
| def set_downcase_subdomain | |
| self.subdomain.downcase! | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment