Skip to content

Remove Adapters #498

Closed
Closed
@moonglum

Description

@moonglum

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 and after_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:

  1. He or she has to add the fields by hand (for example the field for the email, the hashed password, the salt and additional attributes depending on used submodules). So for a developer of ActiveRecord this means adding a migration, for a developer of MongoID adding a few field statements to the model.
  2. Add a handful of methods to the model: find_by_credentials and find_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?

  1. This would solve the problem of addressing each of the ORMs/ODMs by hand. There are currently three adapters and pull request or issues asking for support for more adapters including Datamapper support Datamapper support #472, Couchbase support Couchbase support #454, Sequel support Sequel Support #414 and CouchDB support CouchDB support #291.
  2. This would remove the current complexity of running the tests. Instead of tests for each of the adapters and the requirement of running each of the supported databases, only one test suite is needed running against ActiveModel without any external dependencies on databases.
  3. No adapter specific bugs like Username and email not persisting using Mongoid #343, mongomapper adapter credential_regex slow #352, Tagged emails don't work as username with mongoid #340, In spec/rails3_mongoid, errors raise spec/controller_activity_logging_spec.rb #238, Reset password + Mongoid = "ArgumentError (wrong number of arguments (1 for 0)):" #187, MongoDB: authentications as embedded document #163...
  4. Give the developer more freedom of modeling how to save credentials, tokens etc.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions