它在我的本地计算机上运行正常但在Heroku的rails_admin中使用Puma Web服务器时出现以下错误。
这是我如何使用enumerize
enumerize :date_type, in: { last_date: 0, begin_date: 1 },
default: :last_date, predicates: { prefix: true, only: :last_date },
i18n_scope: 'date_type'
它出现以下错误,我已经从我的rollbar中粘贴了错误。刷新页面几次以某种方式工作,它显示模型页面就好了。但大部分时间都会出错。此外,使用数组而不是哈希来定义date_type,即in: [:last_date, :begin_date]
&在rails_admin的列表视图中没有date_type似乎解决了这个问题,否则我收到以下错误。
NoMethodError: undefined method `empty?' for 0:Fixnum
- 141 non-project frames
1
File "/app/vendor/bundle/ruby/2.3.0/gems/enumerize-2.0.1/lib/enumerize/base.rb" line 98 in block in _set_default_value_for_enumerized_attributes
2
File "/app/vendor/bundle/ruby/2.3.0/gems/enumerize-2.0.1/lib/enumerize/attribute_map.rb" line 23 in block in each
3
File "/app/vendor/bundle/ruby/2.3.0/gems/enumerize-2.0.1/lib/enumerize/attribute_map.rb" line 22 in each_pair
4
File "/app/vendor/bundle/ruby/2.3.0/gems/enumerize-2.0.1/lib/enumerize/attribute_map.rb" line 22 in each
5
File "/app/vendor/bundle/ruby/2.3.0/gems/enumerize-2.0.1/lib/enumerize/base.rb" line 87 in _set_default_value_for_enumerized_attributes
6
File "/app/vendor/bundle/ruby/2.3.0/gems/enumerize-2.0.1/lib/enumerize/base.rb" line 52 in initialize
7
File "/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.8/lib/active_record/inheritance.rb" line 61 in new
8
File "/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.8/lib/active_record/inheritance.rb" line 61 in new
9
File "/app/vendor/bundle/ruby/2.3.0/gems/rails_admin-1.1.1/lib/rails_admin/config/model.rb" line 60 in block (2 levels) in <class:Model>
10
File "/app/vendor/bundle/ruby/2.3.0/gems/rails_admin-1.1.1/lib/rails_admin/config/model.rb" line 60 in each
11
File "/app/vendor/bundle/ruby/2.3.0/gems/rails_admin-1.1.1/lib/rails_admin/config/model.rb" line 60 in detect
12
File "/app/vendor/bundle/ruby/2.3.0/gems/rails_admin-1.1.1/lib/rails_admin/config/model.rb" line 60 in block in <class:Model>
13
File "/app/vendor/bundle/ruby/2.3.0/gems/rails_admin-1.1.1/lib/rails_admin/config/configurable.rb" line 66 in instance_eval
14
File "/app/vendor/bundle/ruby/2.3.0/gems/rails_admin-1.1.1/lib/rails_admin/config/configurable.rb" line 66 in block in register_instance_option
15
File "/app/vendor/bundle/ruby/2.3.0/gems/rails_admin-1.1.1/lib/rails_admin/config/lazy_model.rb" line 60 in method_missing
16
File "/app/vendor/bundle/ruby/2.3.0/gems/rails_admin-1.1.1/app/helpers/rails_admin/application_helper.rb" line 69 in wording_for
17
File "/app/vendor/bundle/ruby/2.3.0/gems/rails_admin-1.1.1/app/controllers/rails_admin/main_controller.rb" line 20 in index
18
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_controller/metal/implicit_render.rb" line 4 in send_action
19
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/abstract_controller/base.rb" line 198 in process_action
20
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_controller/metal/rendering.rb" line 10 in process_action
21
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb" line 20 in block in process_action
22
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb" line 117 in call
23
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb" line 555 in block (2 levels) in compile
24
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb" line 505 in call
25
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb" line 92 in __run_callbacks__
26
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb" line 778 in _run_process_action_callbacks
27
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb" line 81 in run_callbacks
28
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb" line 19 in process_action
29
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_controller/metal/rescue.rb" line 29 in process_action
30
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_controller/metal/instrumentation.rb" line 32 in block in process_action
31
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb" line 164 in block in instrument
32
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb" line 20 in instrument
33
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb" line 164 in instrument
34
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_controller/metal/instrumentation.rb" line 30 in process_action
35
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_controller/metal/params_wrapper.rb" line 250 in process_action
36
File "/app/vendor/bundle/ruby/2.3.0/gems/searchkick-2.2.0/lib/searchkick/logging.rb" line 209 in process_action
37
File "/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.8/lib/active_record/railties/controller_runtime.rb" line 18 in process_action
38
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/abstract_controller/base.rb" line 137 in process
39
File "/app/vendor/bundle/ruby/2.3.0/gems/actionview-4.2.8/lib/action_view/rendering.rb" line 30 in process
40
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_controller/metal.rb" line 196 in dispatch
41
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_controller/metal/rack_delegation.rb" line 13 in dispatch
42
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_controller/metal.rb" line 237 in block in action
43
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb" line 74 in dispatch
44
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb" line 43 in serve
45
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb" line 43 in block in serve
46
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb" line 30 in each
47
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb" line 30 in serve
48
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb" line 817 in call
49
File "/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/engine.rb" line 518 in call
50
File "/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/railtie.rb" line 194 in public_send
51
File "/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/railtie.rb" line 194 in method_missing
52
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/routing/mapper.rb" line 51 in serve
53
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb" line 43 in block in serve
54
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb" line 30 in each
55
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb" line 30 in serve
56
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb" line 817 in call
57
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
58
File "/app/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb" line 189 in call!
59
File "/app/vendor/bundle/ruby/2.3.0/gems/omniauth-1.6.1/lib/omniauth/strategy.rb" line 167 in call
60
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
61
File "/app/vendor/bundle/ruby/2.3.0/gems/rack-pjax-1.0.0/lib/rack/pjax.rb" line 12 in call
62
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
63
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/flash.rb" line 260 in call
64
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
65
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/rack/agent_hooks.rb" line 30 in traced_call
66
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
67
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/rack/browser_monitoring.rb" line 32 in traced_call
68
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
69
File "/app/vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb" line 36 in block in call
70
File "/app/vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb" line 35 in catch
71
File "/app/vendor/bundle/ruby/2.3.0/gems/warden-1.2.7/lib/warden/manager.rb" line 35 in call
72
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
73
File "/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/etag.rb" line 24 in call
74
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
75
File "/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/conditionalget.rb" line 25 in call
76
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
77
File "/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/head.rb" line 13 in call
78
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
79
File "/app/vendor/bundle/ruby/2.3.0/gems/remotipart-1.3.1/lib/remotipart/middleware.rb" line 32 in call
80
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
81
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/params_parser.rb" line 27 in call
82
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
83
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/flash.rb" line 260 in call
84
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
85
File "/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/session/abstract/id.rb" line 225 in context
86
File "/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/session/abstract/id.rb" line 220 in call
87
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
88
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/cookies.rb" line 560 in call
89
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
90
File "/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.8/lib/active_record/query_cache.rb" line 36 in call
91
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
92
File "/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb" line 653 in call
93
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
94
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/callbacks.rb" line 29 in block in call
95
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb" line 88 in __run_callbacks__
96
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb" line 778 in _run_call_callbacks
97
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/callbacks.rb" line 81 in run_callbacks
98
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/callbacks.rb" line 27 in call
99
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
100
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/remote_ip.rb" line 78 in call
101
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
102
File "/app/vendor/bundle/ruby/2.3.0/gems/rollbar-2.14.1/lib/rollbar/middleware/rails/rollbar.rb" line 24 in block in call
103
File "/app/vendor/bundle/ruby/2.3.0/gems/rollbar-2.14.1/lib/rollbar.rb" line 145 in scoped
104
File "/app/vendor/bundle/ruby/2.3.0/gems/rollbar-2.14.1/lib/rollbar/middleware/rails/rollbar.rb" line 22 in call
105
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
106
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/debug_exceptions.rb" line 17 in call
107
File "/app/vendor/bundle/ruby/2.3.0/gems/rollbar-2.14.1/lib/rollbar/middleware/rails/show_exceptions.rb" line 22 in call_with_rollbar
108
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
109
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/show_exceptions.rb" line 30 in call
110
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
111
File "/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/rack/logger.rb" line 38 in call_app
112
File "/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/rack/logger.rb" line 20 in block in call
113
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb" line 68 in block in tagged
114
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb" line 26 in tagged
115
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb" line 68 in tagged
116
File "/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/rack/logger.rb" line 20 in call
117
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
118
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/request_id.rb" line 21 in call
119
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
120
File "/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/methodoverride.rb" line 22 in call
121
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
122
File "/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/runtime.rb" line 18 in call
123
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
124
File "/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.8/lib/active_support/cache/strategy/local_cache_middleware.rb" line 28 in call
125
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
126
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/static.rb" line 120 in call
127
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
128
File "/app/vendor/bundle/ruby/2.3.0/gems/rack-1.6.5/lib/rack/sendfile.rb" line 113 in call
129
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
130
File "/app/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.8/lib/action_dispatch/middleware/ssl.rb" line 24 in call
131
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
132
File "/app/vendor/bundle/ruby/2.3.0/gems/rack-cors-0.4.1/lib/rack/cors.rb" line 81 in call
133
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
134
File "/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/engine.rb" line 518 in call
135
File "/app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.8/lib/rails/application.rb" line 165 in call
136
File "/app/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-4.0.0.332/lib/new_relic/agent/instrumentation/middleware_tracing.rb" line 92 in call
137
File "/app/vendor/bundle/ruby/2.3.0/gems/puma-3.8.2/lib/puma/configuration.rb" line 224 in call
138
File "/app/vendor/bundle/ruby/2.3.0/gems/puma-3.8.2/lib/puma/server.rb" line 600 in handle_request
139
File "/app/vendor/bundle/ruby/2.3.0/gems/puma-3.8.2/lib/puma/server.rb" line 435 in process_client
140
File "/app/vendor/bundle/ruby/2.3.0/gems/puma-3.8.2/lib/puma/server.rb" line 299 in block in run
141
File "/app/vendor/bundle/ruby/2.3.0/gems/puma-3.8.2/lib/puma/thread_pool.rb" line 120 in block in spawn_thread
不明白出了什么问题?
答案 0 :(得分:0)
根据用法部分中的enumerize README,in:
的参数应该是一个数组而不是您提供的哈希值。所以,改变:
in: { last_date: 0, begin_date: 1 }
为:
in: [:last_date, :begin_date]