When someone has a bad influence on you; when they push you to do unacceptable, improper or morally wrong things, like a friend who pushes you to do drugs or drink a lot.
As far as I can recall, it is an expression containing "off the rails", but I searched on Google and couldn't find what I was looking for.
Thanks for your help.
"off the wagon" might be what you are looking for.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.