Fixed JS compatible with Rails 4.1