-
-
Save radar/727694 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
| == MODEL == | |
| // do a check here to verify the requested subdomain is available | |
| def subdomain_is_unique | |
| business = Business.where( "lower(subdomain) = ?", subdomain.downcase ).first | |
| if !business.nil? | |
| errors.add( :subdomain, 'is already in use' ) | |
| else | |
| business = Business.new(:business_name => business_name, :subdomain => subdomain ) | |
| end | |
| self.business_id = business.id | |
| end | |
| == CONTROLLER == | |
| def create | |
| super | |
| if // validations all pass let's create defaults | |
| Business.create_defaults(business_id) | |
| Location.create_defaults(business_id) | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment