Comments (10)
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.
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.
from activeinteractor.
This is possibly a bug, let me investigate this evening.
from activeinteractor.
@majksner can you add the contents of the interactors themselves?
from activeinteractor.
🤔 I've done a bit of testing and it appears to be an issue with the class name Order::PrepareData
specifically.
from activeinteractor.
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.
This appears to be an issue with constantize
in ActiveSupport:
irb(main):005:0> "PrepareData".classify
=> "PrepareDatum"
from activeinteractor.
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.
The issue isn't the nested modules, it's the class names themselves. classify
will return PlaceDataum
or Order::PlaceDatum
.
from activeinteractor.
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)
- Add a State Object
- Add the Result Object
- Ensure interactors return the result object
- Deprecate ActiveInteractor::Context::Status
- 2.0.0 Cleanup
- Remove ActiveInteractor::Context::Status
- Deprecate ActiveInteractor::Context::Errors
- Remove ActiveInteractor::Context::Errors
- [Bug Report] Allow default attributes to propagate to sibling/child interactors
- Add 2.0 Deprecator
- RFC Interactor#perform Cycle HOT 5
- Clean up ActiveInteractor::Context::Attributes
- Exclude Specs from Rubocop
- Address Lint/NoReturnInBeginEndBlocks cop in version.rb
- [Question] What is the expected Rollback behavior with complex skip_rollback ? HOT 6
- Rails 6.1 changes how ActiveModels are deep_dup'ed HOT 2
- Fix the 1-1-stable build
- Rollback unreleased code
- [Question]
- [Bug Report] before_perform invoked before context is validated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from activeinteractor.