Skip to content

Commit

Permalink
Move initializer code into to_prepare block
Browse files Browse the repository at this point in the history
Rails 7 does not autoload constants during boot anymore.
  • Loading branch information
tvdeyen committed Feb 18, 2022
1 parent 6c8313e commit 67e4033
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions spec/dummy/config/initializers/alchemy.rb
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
# frozen_string_literal: true

Alchemy.register_ability Ability
Alchemy.user_class_name = 'DummyUser'
Alchemy.signup_path = '/admin/pages' unless Rails.env.test?
Alchemy::Modules.register_module(
name: 'events',
navigation: {
name: 'Events',
controller: '/admin/events',
action: 'index',
icon: 'calendar-alt',
sub_navigation: [{
name: 'Events',
controller: '/admin/events',
action: 'index'
}, {
name: 'Locations',
controller: '/admin/locations',
action: 'index'
}, {
name: 'Series',
controller: '/admin/series',
action: 'index'
}, {
name: 'Bookings',
controller: '/admin/bookings',
action: 'index'
}]
}
)
Rails.application.config.to_prepare do
Alchemy.register_ability Ability
Alchemy.user_class_name = "DummyUser"
Alchemy.signup_path = "/admin/pages" unless Rails.env.test?
Alchemy::Modules.register_module(
name: "events",
navigation: {
name: "Events",
controller: "/admin/events",
action: "index",
icon: "calendar-alt",
sub_navigation: [{
name: "Events",
controller: "/admin/events",
action: "index",
}, {
name: "Locations",
controller: "/admin/locations",
action: "index",
}, {
name: "Series",
controller: "/admin/series",
action: "index",
}, {
name: "Bookings",
controller: "/admin/bookings",
action: "index",
}],
},
)
end

0 comments on commit 67e4033

Please sign in to comment.