Lambda’s can come in handy when you need to apply a similar mutation to a collection of objects.
Here’s an example of a simple operation but the block can be as complicated or generic as you need.
The urnary ampersand calls the :symbol’s #to_proc method and passes it as a block to the method.
In ruby 1.9.2 and monkey patched in by rails, Symbol#to_proc is defined as:
So our earlier exmaple can be replaced with
So thats the trick behind that ruby magic.