fix rails 4 deprecation warnings

Fix deprecation warnings in rails 4.