Topic: How to create a conditional user profile view?

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?

Re: How to create a conditional user profile view?

I would probably do a one-to-many relationship between a user and guesses.  Guesses would have a guesser_user_id and guessed_user_id.  Then you could do something like:

 if user.guesses.include? current_displayed_user_id
   #show their age
  else
    #ask them to guess their age
  end

Re: How to create a conditional user profile view?

Thanks!

I did that actually and it worked.