smpallen99/coherence

How to preload association when loading user?

jaimeiniesta opened this issue ยท 7 comments

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?

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

๐Ÿ‘ same here.

Not even a hacky solution?

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.

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!

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.

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

Indeed ๐Ÿ˜•