Tag Archives: tip

The “returning” method explained

This one you will find all over the Rails code. The “returning” trick is a really neat way to refactor ugly patterns, such as this one: object = [] object << “foo” if bar? object Into this: returning [] do … Continue reading

Posted by Richard View Comments Posted in Ruby on Rails Tagged ,