Revert "Revert "update to rails 4""

This reverts commit 4da7259ae66ef680017bf563b717abe3bcd34a52.
some fixes needed for rails 4 support