I have restricted one page from other users but if I am not logged in and visit that page, I get an error in the line `redirect_to '/' unless current_user.admin?`

but if I am logged in and visit the page,it works fine.
In my `Application` controller

```
class ApplicationController < ActionController::Base
def require_admin
    redirect_to '/' unless current_user.admin?
end

```

PLEASE can anyone tell me why is this error coming
Thanks in advance!!!