From 162094a798506fe2fb8ee9c2d87c0636695d7438 Mon Sep 17 00:00:00 2001 From: chiu Date: Sun, 16 Aug 2020 14:42:55 +0800 Subject: [PATCH] fix error --- app/controllers/admin/calendars_controller.rb | 2 ++ app/models/event.rb | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/calendars_controller.rb b/app/controllers/admin/calendars_controller.rb index 3792799..3d6cda9 100644 --- a/app/controllers/admin/calendars_controller.rb +++ b/app/controllers/admin/calendars_controller.rb @@ -136,6 +136,8 @@ class Admin::CalendarsController < OrbitAdminController if !bulletin.nil? bulletin.update_attributes(calendar_start_date: p1[:start],calendar_end_date: p1[:end],calendar_all_day: p1[:all_day],calendar_type_id: p1[:calendar_type_id]) end + p1['title_translations'] = @event['title_translations'].merge({I18n.locale.to_s =>p1['title']}) + p1['note_translations'] = @event['title_translations'].merge({I18n.locale.to_s =>p1['note']}) if @event.update_attributes(p1) e = @event.to_json e = JSON.parse(e) diff --git a/app/models/event.rb b/app/models/event.rb index 15d70bd..79e1d42 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -57,10 +57,6 @@ class Event end end end - before_save do - self['title_translations'] = self['title_translations'].merge({I18n.locale.to_s =>self['title']}) - self['note_translations'] = self['title_translations'].merge({I18n.locale.to_s =>self['note']}) - end ######################################## validates_presence_of :title, :message => "Please fill the title of the Event", :if => lambda { self['title_translations'].blank? } validates_presence_of :title_translations, :message => "Please fill the title of the Event", :if => lambda { self['title'].blank? }