If I were doing it, I'd create a 3rd table in my DB, say, "liked_requests", 
which would have a user_id & request_id columns.

Then in the User model, add
many_to_many :liked_requests, :class => 'Request', :join_table => 
:liked_requests

And in the Request model, add
many_to_many :liked_by_users, :class => 'User', ;join_table => :liked_requests

Might need to specify the key to use in each direction, as well.  I'm a bit 
fuzzy on it.

-Joe

On Dec 7, 2010, at 8:14 AM, Scott LaBounty wrote:

> All,
> 
> I'm not sure how to do this in Sequel. I have tables/models for Users and 
> Requests so a User can create a request and there's a "one_to_many requests" 
> in the User model and a "many_to_one user" in the Request model. So far, so 
> good. I'd like to add the capability to allow users to "Like" (not what I'm 
> calling it, but it will at least be familiar from FaceBook). So there, we'd 
> have a many_to_many relationship between the requests and users (users could 
> "Like" many requests and requests could be "Like"d by many users). I'm not 
> sure how to do this since we already have a relationship between the two 
> models.
> 
> Thoughts?
> 
> -- 
> Scott
> http://steamcode.blogspot.com/
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sequel-talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/sequel-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to