-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Adapters #498
Comments
+1 I was having the same thought when writing a couchbase adapter... I opted for doing it as a separate gem instead of a PR: https://github.com/mje113/sorcery-couchbase The first pain I ran into when working on a PR for CB support was the fact that there are development gem dependencies that aren't jruby friendly, and since I'm working in jruby, it was a non-starter. It would be much more developer-friendly if instead of simply removing the ORMs, there were removed to their own gems. Then you'd have the same functionality you get today, with only the inclusion of an additional gem 'sorcery-activerecord' or whatever. |
I think if you really remove the concept of adapters from sorcery, it is still possible to write gems like What do you think? |
Oh sure, wiring things up manually as an option makes sense. Just saying that instead of removing the ORM adapters altogether, they could be moved into separate gems. So we're in agreement I think. Also, ideally you would also want a set of lint tests that would make it easy to ensure your custom ORM library (or in-app code) complies with what sorcery expects. Something like: https://github.com/rails/rails/blob/master/activemodel/lib/active_model/lint.rb |
I totally like this idea 👍 I'd try this as an experiment for 1.x version of Sorcery. |
@mje113 I think the best option would be to have a gem like @kirs Glad you like it 😄 I would be really happy to see this in sorcery. If you need any help, just tell me. I can also do a spike for this functionality so you can see if you like it 😸 |
@moonglum Right, that's exactly the approach I took with sorcery-couchbase. The main pain-point is knowing that I had everything implemented correctly--which is why I think that a good set of Lint tests provided by sorcery would help orm gem authors to fulfill their side of the "contract". @kirs Happy to lend a hand as well. |
I like the idea and will be happy to work on it. Let me know if you need any help. |
I've created the |
Hi, we've started discussing the roadmap for 1.0 release. If anyone's interested in the discussion, join us here: sorcery-rails/sorcery-issues#1 Removing adapters is one of our goal for 1.0 release. |
Here's the first step to remove adapters: arnvald@1c1d96a There's still some work to be done there, especially on the interface of adapters, but I hope we'll have some working version of Sorcery and adapters gems in following weeks |
Adapters were removed in f5115cd Before 1.0 release I'll publish them as external gems (sorcery_mongoid is already published on github). Right now I'm closing the issue. |
Yay 👍 |
I have the idea to remove the adapters and support for specific ORMs/ODMs and instead just assume that the user model is an ActiveModel with the possibility to define
before_save
andafter_save
handlers. This would require the developers to implement a number of methods by themselves (see Tradeoffs).Tradeoffs
For the user of the library that has the following consequences as far as I can see:
field
statements to the model.find_by_credentials
andfind_by_id
for the simple case. If the developer is using token features two additional methods have to be added.Does anyone see any additional tradeoffs?
Why?
Work
I'm more than happy to work on this and send a pull request if you're interested in this change. If you want further investigation, I'm also happy to do that.
The text was updated successfully, but these errors were encountered: