Loading a file in vim via piped output of ag
You could simplify the vim call like this:

vim $(ag '\.where\(.*\)' app | sed -nE '$s/([^:]*):([0-9]*):.*/+\2 \1/p')


That is, no need for the awk to print the matched filename and line number in reverse, you can reverse in the sed, and also prefix the number with + there.

I dropped the tail -1, by using the -n flag of sed to not print output by default, added $ in front of the s/// command to apply for only the last line of input, and the /p flag to print after substitution.
Although this has the benefit of eliminating a tail process in the middle, it has the disadvantage that it's a bit harder to understand. So you can put back tail -n 1 (more portable than tail -1) if you prefer.

I also changed the obsolete `...` to $(...).