Fix has_many lambda syntax so it constructs proprer SQL syntax