I'm using CanCan to authorize users' actions, and it works well, but now I need to display a message to user.
For example, user clicks on 'comment' button, and cancan checks for a following conditions:
- User is activated
- User is not banned
- User registered > 1 day ago.
- At least 10 minutes passed since user's last comment.
Now I have it in cancan's ability model, it tells user "you are not allowed to post a comment" if one of the conditions isn't true.
What is the best way to make messages more detailed? User should see an error like "Your account is not activated" and so on.
I thought to just put a code in controller, but I have not the only User, and I need to do the same at other controllers.