Skip to content

Commit 84d027a

Browse files
committed
Work with initializer
The code in initializers/bootstrap_form.rb runs before the engine is initialized, so I had to move a few things around.
1 parent 27d1e55 commit 84d027a

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

lib/bootstrap_form/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def default_form_attributes
2727
end
2828
end
2929

30-
mattr_accessor :configuration, default: nil
30+
mattr_accessor :configuration, default: ActiveSupport::OrderedOptions.new
3131

3232
class << self
3333
def configure

lib/bootstrap_form/engine.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ class Engine < Rails::Engine
77
config.eager_load_namespaces << BootstrapForm
88
config.autoload_paths << File.expand_path("lib", __dir__)
99

10-
config.bootstrap_form = ActiveSupport::OrderedOptions.new
11-
config.bootstrap_form.default_form_attributes = {}
12-
13-
initializer "bootstrap_form.configure" do |app|
14-
BootstrapForm.configuration = app.config.bootstrap_form
15-
end
10+
config.bootstrap_form = BootstrapForm.configuration
11+
config.bootstrap_form.default_form_attributes ||= {}
1612

1713
initializer "bootstrap_form.deprecator" do |app|
1814
app.deprecators[:bootstrap_form] = BootstrapForm.deprecator

0 commit comments

Comments
 (0)