@@ -23,35 +23,35 @@ def base_path_with_locale
2323 # Returns the current active identity for the user.
2424 # This is a placeholder and should be updated to support active identity features.
2525 def current_identity
26- current_person
26+ @current_identity ||= current_person
2727 end
2828
2929 # Retrieves the current person associated with the signed-in user.
3030 # Returns nil if no user is signed in or the user has no associated person.
3131 def current_person
3232 return unless user_signed_in? && current_user . person
3333
34- current_user . person
34+ @current_person ||= current_user . person
3535 end
3636
3737 # Finds the platform marked as host or returns a new default host platform instance.
3838 # This method ensures there is always a host platform available, even if not set in the database.
3939 def host_platform
40- ::BetterTogether ::Platform . find_by ( host : true ) ||
41- ::BetterTogether ::Platform . new ( name : 'Better Together Community Engine' , url : base_url )
40+ @host_platform ||= ::BetterTogether ::Platform . find_by ( host : true ) ||
41+ ::BetterTogether ::Platform . new ( name : 'Better Together Community Engine' , url : base_url )
4242 end
4343
4444 # Finds the community marked as host or returns a new default host community instance.
4545 def host_community
46- ::BetterTogether ::Community . find_by ( host : true ) ||
47- ::BetterTogether ::Community . new ( name : 'Better Together' )
46+ @host_community ||= ::BetterTogether ::Community . find_by ( host : true ) ||
47+ ::BetterTogether ::Community . new ( name : 'Better Together' )
4848 end
4949
5050 # Retrieves the setup wizard for hosts or raises an error if not found.
5151 # This is crucial for initial setup processes and should be pre-configured.
5252 def host_setup_wizard
53- ::BetterTogether ::Wizard . find_by ( identifier : 'host_setup' ) ||
54- raise ( StandardError , 'Host Setup Wizard not configured. Please run rails db:seed' )
53+ @host_setup_wizard ||= ::BetterTogether ::Wizard . find_by ( identifier : 'host_setup' ) ||
54+ raise ( StandardError , 'Host Setup Wizard not configured. Please run rails db:seed' )
5555 end
5656
5757 # Handles missing method calls for route helpers related to BetterTogether.
0 commit comments