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

How to preload association when loading user? #409

Closed
jaimeiniesta opened this issue Dec 18, 2018 · 7 comments
Closed

How to preload association when loading user? #409

jaimeiniesta opened this issue Dec 18, 2018 · 7 comments

Comments

@jaimeiniesta
Copy link
Contributor

In my app, the User module has a :subscriptions association that I need to preload.

How can I tell Coherence to preload this association when the user is authenticated?

@mido18
Copy link

mido18 commented Jan 25, 2019

wow more than 1 month without solving and it's a basic need !

@augnustin
Copy link

👍 same here.

Not even a hacky solution?

@augnustin
Copy link

Ok, found a hacky solution:

In web.ex, I add:

  def view do
      alias MyApp.Repo
  end

And in the view, before requiring the association, I add:

<% Repo.preload(Coherence.current_user(@conn), :my_association) %>

It is not so bad since it won't be loaded if this specific view is not required.

@jaimeiniesta
Copy link
Contributor Author

For the records, I finally moved from Coherence to Pow - I'm super grateful to the author and all the contributors of Coherence but Pow is being actively maintained, so I'm closing this issue.

Please remember everyone that this is open source so we shouldn't complain because of open issues, let's try to build it together or start something else!

@augnustin
Copy link

Hi @jaimeiniesta

Thanks for getting back.

I don't think there has been complaints about open issue, simply worries about the current maintenance of the project, which appeared to be low and that you now confirmed drowned to zero, since even repo's author moved to another. 😄

I reckon the most urgent thing to do is to inform the repo's visitors:

This project is currently un-maintained in favor of Pow.

Otherwise people using this dependency now are screwed.

@jaimeiniesta
Copy link
Contributor Author

Hey @augnustin I'm not the author of Coherence, you may be mislead by the "author" label but it refers to this issue.

@augnustin
Copy link

Indeed 😕

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

No branches or pull requests

3 participants