change subdomain on heroku + do not save pages, assets, ...etc of a site when it gets saved
This commit is contained in:
parent
1e70560b7b
commit
8b5d5d0a32
@ -12,11 +12,11 @@ class Site
|
|||||||
field :meta_description
|
field :meta_description
|
||||||
|
|
||||||
## associations ##
|
## associations ##
|
||||||
references_many :pages
|
references_many :pages, :validate => false
|
||||||
references_many :snippets, :dependent => :destroy
|
references_many :snippets, :dependent => :destroy, :validate => false
|
||||||
references_many :theme_assets, :dependent => :destroy
|
references_many :theme_assets, :dependent => :destroy, :validate => false
|
||||||
references_many :asset_collections, :dependent => :destroy
|
references_many :asset_collections, :dependent => :destroy, :validate => false
|
||||||
references_many :content_types, :dependent => :destroy
|
references_many :content_types, :dependent => :destroy, :validate => false
|
||||||
embeds_many :memberships
|
embeds_many :memberships
|
||||||
|
|
||||||
## validations ##
|
## validations ##
|
||||||
|
@ -18,10 +18,12 @@ module Locomotive
|
|||||||
|
|
||||||
def add_subdomain_to_domains_with_heroku
|
def add_subdomain_to_domains_with_heroku
|
||||||
unless self.domains_change.nil?
|
unless self.domains_change.nil?
|
||||||
|
old_full_subdomain = "#{self.subdomain_was}.#{Locomotive.config.domain}"
|
||||||
full_subdomain = "#{self.subdomain}.#{Locomotive.config.domain}"
|
full_subdomain = "#{self.subdomain}.#{Locomotive.config.domain}"
|
||||||
|
|
||||||
@heroku_domains_change = {
|
@heroku_domains_change = {
|
||||||
:added => self.domains_change.last - self.domains_change.first - [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 - [full_subdomain]
|
:removed => self.domains_change.first - self.domains_change.last - [old_full_subdomain] - [full_subdomain]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user