Updated for Rails4/Ruby2