stimulusreflex / stimulus_reflex

Build reactive applications with the Rails tooling you already know and love.
https://docs.stimulusreflex.com
MIT License
2.28k stars 172 forks source link

Dependency on ActiveRecord #621

Closed javierg closed 1 year ago

javierg commented 1 year ago

We have a Rails project were ActiveRecord is absent, this project uses CouchDB as main DB and there isn't a sane AR adapter for it, so we use a simple REST adapter to talk to the DB, adding AR is not something that we have now.

past versions of stimulus reflex have been working great without this requirement, but after

https://github.com/stimulusreflex/stimulus_reflex/commit/4c52f316b5b6ac748a6c563ccfc4f1c35b52b779

The app is expecting AR to be required. I wonder if this can be optional? or it is gonna be a hard requirement?

For now I monkey-pacthed the code that expects AR to exists, but just wonder if this will be addressed or should I think on adding AR to my project?

leastbad commented 1 year ago

I cannot guarantee success, but I will try to see what I can do!

julianrubisch commented 1 year ago

Hmmm I cannot really see how the referenced commit introduces the AR. It’s also not required in the (current) StimulusReflex and CableReady gemspecs.

What am I missing? Can you post which SR and CR versions you are running on? Thanks!

javierg commented 1 year ago

Sure:

Cable Ready 3.5.0.pre9 Stimulus Reflex 3.5.0.pre9

Not sure how was happening but since I don't have included AR at all in the project, and checking now the code, I don't see how it was working before, probably my code didn't reached to the updates method.

But now I get the uninitialized constant error on ActiveRecord, and I don't included. And I don't included, because doing so causes a bunch of side effects where a db is expected to be configured with AR.

Thanks for taking a look into this πŸ‘

marcoroth commented 1 year ago

Hey @javierg, which part of StimulusReflex are you using that triggers an uninitialized constant error for ActiveRecord? I did setup an app without ActiveRecord but the usual stuff works even without ActiveRecord in the scope.

marcoroth commented 1 year ago

Oh, I see. It seems that the "uninitialized constant" error only occurs on pre9, but not on master. Therefore, I expect that once we release pre10 in the next few days, that this issue should be resolved. Thank you for your patience and understanding as we work through this.

marcoroth commented 1 year ago

Hey @javierg, thanks for your patience, this should be resolved now via 3.5.0.pre10. Please let us know if that works for you!

javierg commented 1 year ago

Thanks for the hard work on this, the issue is now solved. πŸŽ‰

marcoroth commented 1 year ago

Thanks for the feedback @javierg!