aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/referential.rb
diff options
context:
space:
mode:
authorGuillaume2017-11-09 15:20:54 +0100
committerGuillaume2017-11-09 15:21:01 +0100
commitaafda8b5d8e6dbd80ed56fd469d5ada5dceb3a67 (patch)
tree6e63632be099a8a86fcca69bcc2814efbff57c0a /app/models/referential.rb
parent4dbe0a7b5acf4e244016d58d59a96aca36035263 (diff)
downloadchouette-core-aafda8b5d8e6dbd80ed56fd469d5ada5dceb3a67.tar.bz2
add object_id_format to migrations, create module for call Referential, Line Referential, StopAreaReferential in models, add Enumerize in models Refs #4941
Diffstat (limited to 'app/models/referential.rb')
-rw-r--r--app/models/referential.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/referential.rb b/app/models/referential.rb
index ed13cd077..37cad3c7d 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -1,5 +1,6 @@
class Referential < ActiveRecord::Base
include DataFormatEnumerations
+ extend Enumerize
validates_presence_of :name
validates_presence_of :slug
@@ -55,6 +56,8 @@ class Referential < ActiveRecord::Base
belongs_to :referential_suite
+ enumerize :object_id_format, in: %w(netx netx_stif)
+
scope :ready, -> { where(ready: true) }
scope :in_periode, ->(periode) { where(id: referential_ids_in_periode(periode)) }
scope :include_metadatas_lines, ->(line_ids) { where('referential_metadata.line_ids && ARRAY[?]::bigint[]', line_ids) }