Giter Club home page Giter Club logo

Comments (6)

tgittos avatar tgittos commented on July 4, 2024 1

I definitely think the new proposed architecture is nicer.

Providing a way for the user to specify their own context class is going to make your library more extensible and powerful, and saves me as an end user from monkey patching your code anyway.

I also think context_attributes is too awkward, and much prefer your newer syntax and making it explicit that you're declaring props on a context class that you're also declaring vs an automagical declared context.

I do prefer the sub-classed Context naming convention you had before, for example:
MyInteractor::Context vs MyInteractorContext, but it's a minor thing.

from activeinteractor.

zacharyw avatar zacharyw commented on July 4, 2024 1

What if the default behavior is to create a class (current behavior), unless one with the appropriate naming convention already exists?

In that case the naming convention might even be overkill, and using the self.context_class is the defacto way to do it.

from activeinteractor.

aaronmallen avatar aaronmallen commented on July 4, 2024

I think it would also be beneficial to allow for an interactor to define it's own context class to allow for classes that don't meet the expected naming convention.

class User < ActiveRecord::Base
end

class AuthenticateUser < ActiveInteractor::Base
  self.context_class = User
end

from activeinteractor.

tgittos avatar tgittos commented on July 4, 2024

from activeinteractor.

aaronmallen avatar aaronmallen commented on July 4, 2024

@zacharyw so instead of falling back to a generic context class with no validations and no attribute methods you're suggesting the fallback would be the current behavior?

from activeinteractor.

zacharyw avatar zacharyw commented on July 4, 2024

@aaronmallen I think so. I do see the benefit of being able to set a custom context, but for a lot of simple base case scenarios it may be annoying to have to manually keep creating new classes.

from activeinteractor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.