How to pass multiple attributes to find_or_create_by in Rails 3 : the Ruby way

Ruby and Rails have many magic features like blocks/closures, duck typing/mix-ins/modules,  method_missing, poetry mode.

One of the common tasks in programming web applications on Rails is finding a row in a table by several columns and creating a new row in case of row is missing.

Continue reading