Closed adrian-gomez closed 1 year ago
@excid3 do you think this is something you might want to add to the gem? As we keep using we are coming across some other changes we would like to suggest/implement is a PR the best way to do those? or should we open an issue first? Thanks!
Thanks for this @adrian-gomez
acts_as_tenant
should match the belongs_to
interface since it defines the same thing behind the scenes so it would be great to support scopes. 👍
Would you be able to fix the merge conflicts and I can merge this in?
@excid3 sorry for the delay! I just updated our fork with the latest changes and resolved the merge conflicts
@excid3 thanks for merging this!
Hi @excid3,
I recently came across this issue and it seems to be impacting users. Would it be possible to consider a release for v0.6.2 to address this? Or is there a recommended workaround to bypass this issue?
Hi @ErwinM, thanks for the awesome gem!
We recently started to migrate our whole app to use
acts_as_tenant
and found a small issue for our use case where validations performed byacts_as_tenant
are failing when checking for the existence ofbelongs_to
associations. We have been using https://github.com/rubysherpas/paranoia for a long time (we have plans to migrate away from it in the future but it's not an easy task). So the issue is the default scope generated byparanoia
which makes deleted records to be skipped during validation, that makes sense since those are deleted! but in some scenarios we do want our models to access deleted associations, the way to do that is to pass a scope to the association:right now
acts_as_tenant
is ignoring that scope so the validation fails.The PR will use the scope if given.
An extra addition (that I can move to another PR if you like) is allowing to pass a scope to
act_as_tenant
and just pass the scope directly tobelongs_to
(it seems that's the only modification needed for that to work)