Giter Club home page Giter Club logo

Comments (10)

aaronmallen avatar aaronmallen commented on July 23, 2024 1

I've also noticed if the class is called CleanupFiles same issue. It could be because I'm not using symbols for class names, but I can't since I'm relying on modules.

While I'm here. I've noticed another possible issue. If some of the interactors of the organizer fail context.fail!('Error Message') error message is not persisted.

[10] pry(main)> stripe = StripeCustomer::UpdateCustomer.perform(user: user, params: params)
stripe.success?
=> false

[10] pry(main)> stripe.errors
=> #<ActiveModel::Errors:0x00007fa730422528
 @base=
  #<StripeCustomer::UpdateCustomer::Context user=#<User id: 104..>, params={...}>,
 @details={},
 @messages={}>

Thank you for looking into this.

@majksner could you file a separate bug for this?

from activeinteractor.

aaronmallen avatar aaronmallen commented on July 23, 2024 1

Instead of a documentation change we will use camelize instead of classify to safe_constantize class names. If I have a class defined like PrepareData and I pass an argument to the organize method like :prepare_data, "PrepareData", or PrepareData I should reasonably expect this argument would not be singularized down the chain. Closing this bug as won't fix.

see #168 and #171

from activeinteractor.

aaronmallen avatar aaronmallen commented on July 23, 2024

This is possibly a bug, let me investigate this evening.

from activeinteractor.

aaronmallen avatar aaronmallen commented on July 23, 2024

@majksner can you add the contents of the interactors themselves?

from activeinteractor.

aaronmallen avatar aaronmallen commented on July 23, 2024

🤔 I've done a bit of testing and it appears to be an issue with the class name Order::PrepareData specifically.

from activeinteractor.

majksner avatar majksner commented on July 23, 2024

I've also noticed if the class is called CleanupFiles same issue. It could be because I'm not using symbols for class names, but I can't since I'm relying on modules.

While I'm here. I've noticed another possible issue. If some of the interactors of the organizer fail context.fail!('Error Message') error message is not persisted.

[10] pry(main)> stripe = StripeCustomer::UpdateCustomer.perform(user: user, params: params)
stripe.success?
=> false

[10] pry(main)> stripe.errors
=> #<ActiveModel::Errors:0x00007fa730422528
 @base=
  #<StripeCustomer::UpdateCustomer::Context user=#<User id: 104..>, params={...}>,
 @details={},
 @messages={}>

Thank you for looking into this.

from activeinteractor.

aaronmallen avatar aaronmallen commented on July 23, 2024

This appears to be an issue with constantize in ActiveSupport:

irb(main):005:0> "PrepareData".classify
=> "PrepareDatum"

from activeinteractor.

majksner avatar majksner commented on July 23, 2024

I see it singularizes string.

[2] pry(main)> "PrepareFiles".classify
=> "PrepareFile"
[3] pry(main)> "PrepareThings".classify
=> "PrepareThing"
[4] pry(main)> "Generates".classify
=> "Generate"

Maybe I can send you a pull request for documentation to mention this? Aside from this, putting organizers into modules that I mentioned at the beginning of this issue is a way to go or you have a better suggestion?

from activeinteractor.

aaronmallen avatar aaronmallen commented on July 23, 2024

The issue isn't the nested modules, it's the class names themselves. classifywill return PlaceDataum or Order::PlaceDatum.

from activeinteractor.

aaronmallen avatar aaronmallen commented on July 23, 2024

I've also added a new bug, #168, for this... for Symbol or String the fix should be to document the use of classify, however If I pass a Class or Module directly I would expect that to be found correctly.

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.