activeadmin-plugins / active_admin_datetimepicker

:calendar: active_admin_datetimepicker gem
MIT License
72 stars 48 forks source link

when default options not present: `undefined method `map' for nil:NilClass` #19

Closed gbirchmeier closed 8 years ago

gbirchmeier commented 8 years ago

(version 0.2.0, rails 4.0.14, ruby 2.1.0, activeadmin 1.0.0.pre1)

I followed the instructions in the README, but I get this error when I try to load my ActiveAdmin page:

undefined method `map' for nil:NilClass

top of framework trace:
  active_admin_datetimepicker (0.2.0) lib/active_admin_datetimepicker/base.rb:48:in `_default_datetime_picker_options'
  active_admin_datetimepicker (0.2.0) lib/active_admin_datetimepicker/base.rb:41:in `datetime_picker_options'
  active_admin_datetimepicker (0.2.0) lib/active_admin_datetimepicker/base.rb:23:in `input_html_options'

I saw that the submitter of #18 had an initializer, so I added this to the bottom of my `config/initializers/active_admin.rb":

ActiveAdminDatetimepicker::Base.default_datetime_picker_options = {}

This made my AA object-creation form work. Should that line be necessary?

gbirchmeier commented 8 years ago

I think I see what's happening. Similar to #20 that I just submitted, the mattr_accessor :default_datetime_picker_options block isn't setting the default value.

If you agree, feel free to close one of #19 or #20 as a dupe of the other.

Are any of this Gem's developers observing the default values of mattr_accessor to work?

gbirchmeier commented 8 years ago

Closing this in favor of #20. They have the same root cause.