Last active
September 14, 2019 16:46
-
-
Save eri-b/aa879ef430a4b88dc433e7ef33906ca6 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
| class Site < ApplicationRecord | |
| before_create :lock_init | |
| VALID_NAME_REGEX = /\A[a-zA-Z\d\-]+\z/i # letters, numbers, dashes | |
| validates :name, presence: true, uniqueness: true, length: { maximum: 50 }, format: { with: VALID_NAME_REGEX } | |
| has_secure_password validations: false | |
| private | |
| def lock_init | |
| self.locked = false | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment