add validation (in progress)

This commit is contained in:
dinedine 2011-03-31 09:10:42 +02:00
parent 031113799e
commit 19b6341ace

View File

@ -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}"