Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not abort if user class cannot be found #1950

Merged
merged 4 commits into from Oct 26, 2020

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Oct 21, 2020

What is this pull request for?

We must not abort the Rails boot process if a user class has not been set or cannot be found. Instead we log a warning and return nil as Alchemy.user_class.

It is now important that no extension or app code expects that a Alchemy.user_class exists.

An accompany PR has been made to alchemy-solidus AlchemyCMS/alchemy-solidus#69

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

Instead of manually checkin if the user class is an active record we use the ActiveSupport.on_load callback that gracefully handles auto loading. This should help to avoid early aborts of user class missing errrors during boot time.
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.
@tvdeyen tvdeyen marked this pull request as ready for review October 21, 2020 07:55
@tvdeyen tvdeyen requested a review from mamhoff October 21, 2020 07:58
@tvdeyen tvdeyen changed the title Better user stamper Do not abort if user class cannot be found Oct 21, 2020
If a user class has not been set yet we must not raise, so we do not interupt booting the application. Instead log a helpful warning.
@tvdeyen tvdeyen changed the base branch from master to main October 26, 2020 19:45
@tvdeyen tvdeyen merged commit 06fc6e1 into AlchemyCMS:main Oct 26, 2020
@tvdeyen tvdeyen deleted the better-user-stamper branch October 26, 2020 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants