Update index.erb

refactor using lambda functions (seems js but it's ruby2) :)