Use a piece of non-slip shelf liner under the ruler to keep it from slipping. It works great...no more sliding!

You can get that shelf liner in dollar stores.