diff options
| author | jpl | 2017-05-22 16:50:24 +0200 |
|---|---|---|
| committer | jpl | 2017-05-22 16:50:48 +0200 |
| commit | 447c954b74045d52b449adb252fd2f20438e4669 (patch) | |
| tree | 2068e78aa04874e47337d2c8014707b4a4cf9e99 /app/models/time_table_combination.rb | |
| parent | b8bc80a30cdee3448cb97483451a16573ee7bc26 (diff) | |
| download | chouette-core-447c954b74045d52b449adb252fd2f20438e4669.tar.bz2 | |
Refs #3406: updating ttCombination layout
Diffstat (limited to 'app/models/time_table_combination.rb')
| -rw-r--r-- | app/models/time_table_combination.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/time_table_combination.rb b/app/models/time_table_combination.rb index ec3c74641..9b5111014 100644 --- a/app/models/time_table_combination.rb +++ b/app/models/time_table_combination.rb @@ -1,4 +1,5 @@ class TimeTableCombination + include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming @@ -10,8 +11,8 @@ class TimeTableCombination validates :time_table_id, presence: true, if: "calendar_id.blank?" validates :calendar_id, presence: true, if: "time_table_id.blank?" + validates_inclusion_of :combined_type, :in => %w(time_table calendar) validates_inclusion_of :operation, :in => %w(union intersection disjunction), :allow_nil => true - validates_inclusion_of :combined_type, :in => %w(time_table calendar) def clean self.source_id = nil @@ -23,13 +24,14 @@ class TimeTableCombination end def self.operations - %w( union intersection disjunction) + %w(union intersection disjunction) end def initialize(attributes = {}) attributes.each do |name, value| send("#{name}=", value) end + self.combined_type = "time_table" end def persisted? |
