You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an issue with groupdate when combined with the latest version of activerecord-sqlserver-adapter. The sqlserver-adapter gem is overriding the ActiveRecord::Relation#calculate with a prepend as you can see here. with that, the groupdate calculate method is never executed, causing weird issues that are not obvious until you start debugging the gem.
I was able to fix the issue by prepending the groupdate calculate method as well, so both methods are executed (you have to be aware of the load order). This is the patch I used:
module Groupdate
module RelationPatch
extend ActiveSupport::Concern
def calculate(*args, &block)
default_value = [:count, :sum].include?(args[0]) ? 0 : nil
Groupdate.process_result(self, super, default_value: default_value)
end
end
end
ActiveRecord::Relation.prepend(Groupdate::RelationPatch)
can we change groupdate to prepend instead of including the relation concern? if we do that I would be able to fix this issue just by moving the groupdate gem to the end of the gemfile instead of having to patch it.
The text was updated successfully, but these errors were encountered:
I have an issue with
groupdate
when combined with the latest version ofactiverecord-sqlserver-adapter
. The sqlserver-adapter gem is overriding the ActiveRecord::Relation#calculate with a prepend as you can see here. with that, thegroupdate
calculate method is never executed, causing weird issues that are not obvious until you start debugging the gem.I was able to fix the issue by prepending the
groupdate
calculate method as well, so both methods are executed (you have to be aware of the load order). This is the patch I used:can we change
groupdate
to prepend instead of including the relation concern? if we do that I would be able to fix this issue just by moving thegroupdate
gem to the end of the gemfile instead of having to patch it.The text was updated successfully, but these errors were encountered: