From d5d7785e9a3b67aaf64b7f37dadcb1d122bc9f40 Mon Sep 17 00:00:00 2001 From: Bryan Hockey Date: Wed, 26 Oct 2016 16:26:10 -0500 Subject: [PATCH 1/2] Fail on definition if date_format not passed to map_date --- app/adapters/adapter.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/adapters/adapter.rb b/app/adapters/adapter.rb index bb615c31..9d7b3f71 100644 --- a/app/adapters/adapter.rb +++ b/app/adapters/adapter.rb @@ -20,6 +20,7 @@ def map_simple(model_field, public_field) # @param [Symbol] public_field # @param [String] date_format The Date format to use. def map_date(model_field, public_field, date_format) + raise ArgumentError, "date_format cannot be nil" if date_format.nil? map_from_public public_field do |value| {model_field => time_from_public(value)} end From 51db157e8278a300bb50ec4fd7d0c4a285bf3b07 Mon Sep 17 00:00:00 2001 From: Bryan Hockey Date: Thu, 27 Oct 2016 17:04:03 -0500 Subject: [PATCH 2/2] Move time_formats.rb out of initializers, require it earlier in the init process --- config/application.rb | 2 ++ config/{initializers => }/time_formats.rb | 0 2 files changed, 2 insertions(+) rename config/{initializers => }/time_formats.rb (100%) diff --git a/config/application.rb b/config/application.rb index af43e35b..e51f164a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -46,6 +46,8 @@ class Application < Rails::Application :request_specs => true end + require_relative 'time_formats' + end end end diff --git a/config/initializers/time_formats.rb b/config/time_formats.rb similarity index 100% rename from config/initializers/time_formats.rb rename to config/time_formats.rb