Fixed the issue by injecting user in session maintained by cancan