Policy implementation for rails