def delete_users
users = User.active.where(:id=>params[:users])
users.each do |user|
array = []
if user.active?
array << user
end
end
if (array.count > 0)
user.update_attributes(:status => "inactive")
else
"I want an alert/popup here saying no users, when 'delete_users' is called and the condition comes here."
........ do other stuff ......
end
end
end
In a controller, I have this method, the ajax call will be made to get to this method and when the condition comes to else, I need an alert/popup saying no users are there to delete, then I can update some other thing.
Thanks in advance.