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.

ints_to_floats = lambda { |i| i.to_f }
#=> [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
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: { |*args| args.shift.__send__(self, *args) }

So our earlier exmaple can be replaced with

#=> [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]

So thats the trick behind that ruby magic.