Fixed SQL associations input

Used wrong parameter on 'when, let' statement.