Issue #1130 tweaked to follow rails conventions