aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/referential.rb
diff options
context:
space:
mode:
authorZog2018-05-02 09:45:17 +0200
committerZog2018-05-02 09:45:17 +0200
commit1fa2cf609c71952c6807db16bde6878b211a413a (patch)
tree277d09900ad23a8b6dd21d8aface16c7059a6663 /app/models/referential.rb
parent6779a070b8d5d6d738539f84e4405a86337f7dfb (diff)
downloadchouette-core-1fa2cf609c71952c6807db16bde6878b211a413a.tar.bz2
Refs #6572; Crete Referentials in a pending state
And fix a bug preventing the deletion of referentials without a schema
Diffstat (limited to 'app/models/referential.rb')
-rw-r--r--app/models/referential.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/referential.rb b/app/models/referential.rb
index 933bc78e3..b4f64fad1 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -59,7 +59,6 @@ class Referential < ApplicationModel
belongs_to :referential_suite
-
scope :pending, -> { where(ready: false, failed_at: nil, archived_at: nil) }
scope :active, -> { where(ready: true, failed_at: nil, archived_at: nil) }
scope :failed, -> { where.not(failed_at: nil) }
@@ -271,7 +270,8 @@ class Referential < ApplicationModel
stop_area_referential: from.stop_area_referential,
created_from: from,
objectid_format: from.objectid_format,
- metadatas: from.metadatas.map { |m| ReferentialMetadata.new_from(m, organisation) }
+ metadatas: from.metadatas.map { |m| ReferentialMetadata.new_from(m, organisation) },
+ ready: false
)
end
@@ -471,6 +471,7 @@ class Referential < ApplicationModel
end
def destroy_schema
+ return unless ActiveRecord::Base.connection.schema_names.include?(slug)
Apartment::Tenant.drop slug
end