diff options
Diffstat (limited to 'app/models/calendar.rb')
| -rw-r--r-- | app/models/calendar.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/calendar.rb b/app/models/calendar.rb index 40dfa1210..e0f0f03da 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -17,11 +17,16 @@ class Calendar < ActiveRecord::Base has_many :time_tables scope :contains_date, ->(date) { where('date ? = any (dates) OR date ? <@ any (date_ranges)', date, date) } + before_create :set_default_days def self.ransackable_scopes(auth_object = nil) [:contains_date] end + def set_default_days + self.int_day_types ||= EVERYDAY + end + def convert_to_time_table Chouette::TimeTable.new.tap do |tt| self.dates.each do |d| |
