This relates to learning RubyOnRails which I believe is often installed on or with Ubuntu.
Necessary? Certainly not. You can replace your laptop's operating system with Ubuntu and that works well for a lot of people.
But if you're happy with your existing operating system and just want Ubuntu for testing a Rails stack, virtualisation offers a quick, easy and non-permanent method for getting going.
There are even pre-built "virtual appliance" images for testing Ruby which might be the quickest way to get developing but I would strongly advise against pushing these to production.