I am creating an application regarding the book in which the user can read the content of the book. I want the user should be automatically redirect to the login page after the interval of 30 seconds while reading the book. For login / logout I’m using Devise. I have created a new controller named “pustak_controller.rb” for the purpose of session. I am totally new to this. I have tried to create the follow login  but it gives me an error " undefined method `-’ for nil:NilClass ". Please help and tell me where I am going wrong.