When you want to add a condition around a code fragment in the editor, press &shortcut:SurroundWith; (Code | Surround With) and choose if...end or if...then...end.
This works in the Ruby code and ERB/RHTML files inside Ruby on Rails projects.
You can customize the bodies of the generated blocks on the Code tab of File and Code Templates of your Settings/Preferences .
Use other items in the list to surround with other constructs.