remove unnecessary code in erb files and fixing redirection probleam for ajax responce