Joined April 2015
·

Albert

Peterborough
·
·

Hi. Im getting an error when trying this with Rails 4.2.0. The error is: PG::ProtocolViolation: ERROR: bind message supplies 0 parameters, but prepared statement "" requires 2. Any ideas how I can get round this?

Edit: Apparently a known bug. I got round this like so:

scope :first_payment_between, -> (from, to) {
    joins(self.first_card_payment_between(from,to).values[:joins])
    .joins(self.first_direct_payment_between(from,to).values[:joins])
    .where(first_card_payment_between(from,to).ast.cores.last.wheres.inject{|ws, w| (ws &&= ws.and(w)) || w}
    .or(first_direct_payment_between(from,to).ast.cores.last.wheres.last))
  }

Hope that helps someone :-)

Achievements
1 Karma
0 Total ProTip Views