add validation (in progress)
This commit is contained in:
parent
031113799e
commit
19b6341ace
@ -7,6 +7,8 @@ module Locomotive
|
||||
|
||||
included do
|
||||
|
||||
validate :subdomain_availability
|
||||
|
||||
after_save :add_bushido_domains
|
||||
after_destroy :remove_bushido_domains
|
||||
|
||||
@ -17,6 +19,12 @@ module Locomotive
|
||||
|
||||
protected
|
||||
|
||||
def subdomain_availability
|
||||
unless ::Bushido::App.check_subdomain_availability?(self.subdomain)
|
||||
self.errors.add(:subdomain, :exclusion)
|
||||
end
|
||||
end
|
||||
|
||||
def add_subdomain_to_domains_with_bushido
|
||||
unless self.domains_change.nil?
|
||||
full_subdomain = "#{self.subdomain}.#{Locomotive.config.default_domain}"
|
||||
|
Loading…
Reference in New Issue
Block a user