You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would love to see the ability to define custom Context classes as long as they implement the proper methods (Similar to ActiveModel linting).
Reason being is that OpenStruct leaves a lot of room for error, and have a proper domain object for context would alleviate a lot of that. For example, it would be really nice to be able to do:
Interactor::BaseContext would implement all of the necessary internals of a context, for example fail! and rollback!.
But since it doesn't include OpenStruct, the only values that can be set are email and password due to the attr_accessor in the custom context class.
I like this because it makes you think of your design more coherently and actually gives more options at the end of an interactor call. For example, errors:
I would love to see the ability to define custom Context classes as long as they implement the proper methods (Similar to ActiveModel linting).
Reason being is that OpenStruct leaves a lot of room for error, and have a proper domain object for context would alleviate a lot of that. For example, it would be really nice to be able to do:
Explanation of what this example is doing:
Interactor::BaseContext
would implement all of the necessary internals of a context, for examplefail!
androllback!
.But since it doesn't include
OpenStruct
, the only values that can be set areemail
andpassword
due to theattr_accessor
in the custom context class.I like this because it makes you think of your design more coherently and actually gives more options at the end of an interactor call. For example, errors:
The text was updated successfully, but these errors were encountered: