I'm attempting to average the last n rows in a column in an activerecord query like so:
Points.where(player_id: <player_id>).limit(5).average(:points)
but it gives me the same answer as if I leave the limit out like:
Points.where(player_id: <player_id>).average(:points)
If I test without the .average(:points) then I get only five rows, but it seems the average is ignoring this.
Any help much appreciated!