Debug Foreman with RubyMine

Open Debug Configurations and select Gem Command

Debug Configurations

Create a new configuration like the image below

New config

Done !