fixed the issue with method using deprecated method of rails 4