Merge pull request #677 from sgmap/fix_indentation_in_models_champ

Fix indentation in models champ
This commit is contained in:
Mathieu Magnin 2017-08-29 11:01:53 +02:00
commit d3c48c92e2

View file

@ -71,9 +71,9 @@ class Champ < ActiveRecord::Base
def serialize_datetime_if_needed
if (value =~ /=>/).present?
date = begin
hash_date = YAML.safe_load(value.gsub('=>', ': '))
year, month, day, hour, minute = hash_date.values_at(1,2,3,4,5)
DateTime.new(year, month, day, hour, minute).strftime("%d/%m/%Y %H:%M")
hash_date = YAML.safe_load(value.gsub('=>', ': '))
year, month, day, hour, minute = hash_date.values_at(1,2,3,4,5)
DateTime.new(year, month, day, hour, minute).strftime("%d/%m/%Y %H:%M")
rescue
nil
end