# How to create a conditional user profile view?

**URL:** <https://www.ruby-forum.com/t/how-to-create-a-conditional-user-profile-view/191223>\
**Category:** Rails\
**Created:** [July 7, 2010, 5:36pm UTC](https://www.ruby-forum.com/t/how-to-create-a-conditional-user-profile-view/191223 "2010-07-07T17:36:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![designium](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@designium](https://www.ruby-forum.com/u/designium)\
**Post date:** [July 7, 2010, 5:36pm UTC](https://www.ruby-forum.com/t/how-to-create-a-conditional-user-profile-view/191223/1 "2010-07-07T17:36:45Z")

</div>

Hi,  
I’m developing a very simple social network game where users guess other  
users’ age by just looking one profile picture.  
Everything seems to be very simple except for one thing. I want the use  
case to be the following:

1. I am user A.
2. I VIEW user B nickname and picture but I cannot see the user B’s AGE.
3. In that same page, I SEND my AGE guess of user B.
4. SYSTEM thanks me and SHOWS user B’s profile with AGE and all other  
information.  
What is the best practice to create a model that user A can only see  
user B’s age after sending his age guess?  
I though of using flag-variable but I’m bit confused.  
Option 1:

- Create model User with voted\_user\_id. This variable starts null and  
only gets number after voting for user B & others.  
Option 2:
- Create a new model called Handshake. User has\_many Handshakes.  
Handshake has two variables user\_see\_id and user\_voted\_id. User\_see\_id  
is the User A in the use case and user\_voted\_id is the user B.  
Handshake’s variables are only created at stage 3 (above paragraph). So,  
the system will make a check to see if Handshake was created and if yes,  
it shows the age otherwise it shows a link for guessing.  
Option 3:
- Any other simpler idea?
