Implement strategy design pattern to enhance onboarding code
Summary
To increase readability and future maintenance of the onboarding area. We should start to implement some ruby design patterns.
In this case the desired design pattern will be the strategy pattern.
Solution
This might be the way it looks:
class TrialRegistration
def redirect_to_company_form?
true
end
end
class FreeRegistration
def redirect_to_company_form?
false
end
end
class OnboardingStatus
delegate :redirect_to_company_form?, to: :@registration_type
end
-
1st iteration, introduce and use for one - !155901 (merged) -
2nd iteration - !156233 (merged) -
3rd iteration - !157978 (merged) -
Final iteration - !156075 (merged)
Edited by Doug Stull