anonymous user modeling

Mr_Tibs
Sun, 11 Dec 2011 19:48:51 -0000

Hello,

I''m working on my first simple Rails app in which users submit sport
"tweets" (e.g. "tennis, squash") and the server matches them
up with
partners. The server will return you a list of SportMatches based on
similar tweets and you have different options (e.g. email, SMS) to
reply back to someone''s tweet and accept him/her as partner.
Initially, the modeling was straight forward since: User has_many
SportTweets and SportTweet belongs to User. Notifications were simply
part of the User, or they could have been modeled as a 1-to-1
relationship to User.

My business requirements changed a little, as now I have anonymous
users who can also post SportTweets. Because they don''t have an
account/profile, they must also submit notifications (e.g. email, SMS)
with the tweet. I don''t know how to model this the Rails way.
SportTweets are now either anonymous, or authenticated-user-posted
(AUP). So, now, my SportTweets table will have the following columns:
- type: either "anonymous" or "AUP"
- user_id: only for AUP
- notifications_id: only for anonymous
- sports: for all
- post_date: for all
- post_location: for all
- etc.

There would be a Notifications table. A notification record would
belong either to a User, or to a SportsTweet. I guess I would model
this with polymorphic associations.

That just doesn''t look like the Rails way. Did anyone come across a
similar problem? How did you solve it?

Thanks,
T

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org