Skip to content
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

Use another id than current_user's one #37

Open
thomascailhol opened this issue Oct 21, 2020 · 5 comments
Open

Use another id than current_user's one #37

thomascailhol opened this issue Oct 21, 2020 · 5 comments

Comments

@thomascailhol
Copy link

Hi there,

Thanks for the great job with Abraham. I was wondering if there was any possibility to pass in some other model id to a tour? Not just the user's one via current_user?

Thanks,

Thomas

@jabbett
Copy link
Contributor

jabbett commented Apr 15, 2021

There are three places where we use current_user.id ... not quite sure yet how we'd make that configurable, but open to suggestions!

@scarroll32
Copy link
Contributor

Out of interest, why would you want to do this @thomascailhol ?

@prschmid
Copy link
Contributor

@jabbett Not sure if there is interest in moving this issue forward, but a potential way to refactor the code to make it work without current_user.id is to define an overridable function that is used in place of current_user. For example, we could do something like

def trackable_id
  current_user.id
end

This above defaults to using the current_user as the way to identify who the tours should relate to, but can easily then be overridden by someone else. It may also help remove the "implicit dependency" on how Devise does things. Haven't really thought it in it's entirety, but something like this could work (and may also help folks how are confused by having to have a current_user function (e.g. #61). Just my 2 cents =)

@jabbett
Copy link
Contributor

jabbett commented Oct 7, 2021

@prschmid Thanks — I like it!

And it seems that it would be backwards-compatible for (I assume) most current Abraham users who have relied on the standard Devise setup.

@jabbett
Copy link
Contributor

jabbett commented Feb 17, 2022

@prschmid I'm having the darnedest time figuring out where that overridable function should be defined such that it can be used within AbrahamHelper and AbrahamHistoriesController. Any advice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants