This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.
Message originally sent by slack user U721YFNO7M0
@stephan On a similar note, I have another case where trying to follow the pattern in the first part of your book where it breaks the application_**
files into a rails_shims
. The user pack depends on the rails shims pack for application record and application controller, but then application controller depends on User
for setting a @current_user
with auth. is there a better way?
Not a simple one if you come from devise where this feels natural. The patterns will feel like they repeat themselves quickly:
• Dependency inject an interface of an “actor that is authenticable”
• Extract the authentication functionality into a smaller-then-user class and either inject that or maybe keep it in the shims package
• Do nothing - accept that this is a modularization todo for now
@stephan Can you provide any more details on your first suggestion (above), “Dependency inject an interface of an “actor that is authenticable”?
I’m not sure I’m tracking the general direction you’re pointing for how to resolve <@U721YFNO7M0>’s question/issue.