namick/obfuscate_id

ActiveRecord::RecordNotFound: Couldn't find User with an out of range ID

adamw005 opened this issue · 0 comments

I'm using obfuscate_id on most of my models and everything's been working great so far. But when I try the following line: TransactionQueue.group(:user).sum(:amount) I get the error ActiveRecord::RecordNotFound: Couldn't find User with an out of range ID Both User and TransactionQueue use obfuscated_id

class TransactionQueue < ActiveRecord::Base
  obfuscate_id :spin => 123
  belongs_to :project
  belongs_to :user
  belongs_to :reward_tier
  belongs_to :release
  scope :monthly_transaction_queues, -> { where(type: 'MonthlyTransactionQueue') }
  scope :release_transaction_queues, -> { where(race: 'ReleaseTransactionQueue') }

  # We will need a way to know which subscriptions will subclass the Subscription model
  def self.types
    %w(MonthlyTransactionQueue ReleaseTransactionQueue)
  end

end