Fix bugs when run ruby-1.8.7 because of Rails 4's code-style