Skip to content

Commit

Permalink
Merge commit 'core/fix-save-domain-db' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Aug 3, 2010
2 parents 4ef03a3 + 82d43f2 commit 16e5982
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions app/models/domain.rb
Expand Up @@ -175,12 +175,18 @@ def get_info
end

def save_database_file
return unless File.exists?(self.database_file)

if self.domain_database
self.domain_database.update_attributes :options => YAML.load_file(self.database_file)
else
self.create_domain_database :client_id => self.client_id, :name => self.database, :options => YAML.load_file(self.database_file), :max_file_storage => (self.max_file_storage || DomainDatabase::DEFAULT_MAX_FILE_STORAGE)
if File.exists?(self.database_file)
if self.domain_database
self.domain_database.update_attributes :options => YAML.load_file(self.database_file)
else
self.domain_database = DomainDatabase.find_by_name(self.database)
unless self.domain_database
self.create_domain_database :client_id => self.client_id, :name => self.database, :options => YAML.load_file(self.database_file), :max_file_storage => (self.max_file_storage || DomainDatabase::DEFAULT_MAX_FILE_STORAGE)
end
self.save
end
elsif self.domain_database.nil?
self.domain_database = DomainDatabase.find_by_name(self.database)
self.save
end
end
Expand Down

0 comments on commit 16e5982

Please sign in to comment.