change subdomain on heroku + do not save pages, assets, ...etc of a site when it gets saved

This commit is contained in:
did 2011-04-27 10:09:19 +02:00
parent 1e70560b7b
commit 8b5d5d0a32
2 changed files with 9 additions and 7 deletions

View File

@ -12,11 +12,11 @@ class Site
field :meta_description
## associations ##
references_many :pages
references_many :snippets, :dependent => :destroy
references_many :theme_assets, :dependent => :destroy
references_many :asset_collections, :dependent => :destroy
references_many :content_types, :dependent => :destroy
references_many :pages, :validate => false
references_many :snippets, :dependent => :destroy, :validate => false
references_many :theme_assets, :dependent => :destroy, :validate => false
references_many :asset_collections, :dependent => :destroy, :validate => false
references_many :content_types, :dependent => :destroy, :validate => false
embeds_many :memberships
## validations ##

View File

@ -18,10 +18,12 @@ module Locomotive
def add_subdomain_to_domains_with_heroku
unless self.domains_change.nil?
old_full_subdomain = "#{self.subdomain_was}.#{Locomotive.config.domain}"
full_subdomain = "#{self.subdomain}.#{Locomotive.config.domain}"
@heroku_domains_change = {
:added => self.domains_change.last - self.domains_change.first - [full_subdomain],
:removed => self.domains_change.first - self.domains_change.last - [full_subdomain]
:added => self.domains_change.last - self.domains_change.first - [old_full_subdomain] - [full_subdomain],
:removed => self.domains_change.first - self.domains_change.last - [old_full_subdomain] - [full_subdomain]
}
end