trestle-auth icon indicating copy to clipboard operation
trestle-auth copied to clipboard

Purpose / How to configure to use existing model

Open timdiggins opened this issue 7 years ago • 2 comments
trafficstars

I've been using trestle happily with my own hand-rolled auth (basically doing Trestle::ApplicationController.send(:include, MyAuthConcern in a Trestle.configure block).

However I wanted to add trestle-sidekiq to the mix and it requires trestle-auth.

I was surprised that the generator for trestle-auth just made a model -- I thought it might just generate an initializer (a la Devise).

Is the purpose of Trestle Auth just to provide a model etc, or to be more of a generic framework for auth ?

I'm happy to contribute, but not at all sure how yet.

timdiggins avatar Sep 13 '18 06:09 timdiggins

The generator for trestle-auth both generates a default model as well as injects (mostly commented) configuration code into an existing config/initializers/trestle.rb.

If you are using an existing model, then you should be able to delete the generated model & migration, and customize the configuration variables and blocks to suit your own model. If you find that the existing hooks are too limited for your use case, please open an issue (or PR) and we'll see how it can best be resolved.

spohlenz avatar Sep 13 '18 06:09 spohlenz

Thank you (so quick too!). I've can see the modifications to the initializer now (I had to remove some of my code from config/initializers/trestle.rb so didn't spot that the file had also been modified by the generator).

timdiggins avatar Sep 13 '18 07:09 timdiggins