Skip to content

Commit

Permalink
Do not expect a user class to be present during boot
Browse files Browse the repository at this point in the history
While setting up a fresh Alchemy in a project that has a custom user class and has not told Alchemy yet about it, we must not raise an error if the user class is missing.
  • Loading branch information
tvdeyen committed Oct 21, 2020
1 parent b937110 commit 27fe9d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/alchemy/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ class Engine < Rails::Engine
end

initializer "alchemy.userstamp" do
ActiveSupport.on_load(:active_record) do
Alchemy.user_class.model_stamper
Alchemy.user_class.stampable(stamper_class_name: Alchemy.user_class_name)
if Alchemy.user_class
ActiveSupport.on_load(:active_record) do
Alchemy.user_class.model_stamper
Alchemy.user_class.stampable(stamper_class_name: Alchemy.user_class_name)
end
end
end
end
Expand Down

0 comments on commit 27fe9d0

Please sign in to comment.