has-friendship / has_friendship

Add friendship to ActiveRecord models
MIT License
198 stars 98 forks source link

Separate table/model for friendship blocking records #12

Open sungwoncho opened 9 years ago

sungwoncho commented 9 years ago

friendship table contains too much information, it would be nice if some of them are decoupled.

I think it'd be a good idea to make a separate table/model for records for friendship block/unblock, with blocker_id and blockee_id.

Pensarfeo commented 8 years ago

If we have a blocker_id we don't need a blockee_id. We could also just add a "blocked" and "bocked_by" status; according to whom blocked the relation.

sungwoncho commented 8 years ago

You're right. We don't need both blocker_id and blockee_id. Plus, they sound funny. Maybe the new table blocked_friendships could have friendship_id foreign key and blocker_id, and blocker_type to make the polymorphic association complete.

Pensarfeo commented 8 years ago

I have been thinking about it and it seems more logical to me to keep the same convention you used for the friendship request. That way we keep the table cleaner. I think we should add some validations too

sungwoncho commented 8 years ago

What convention do you mean? Do you mean that we keep the current structure?

Pensarfeo commented 8 years ago

Just like for a request we have "requested" and "pending", we can do the same for blocked records: for example we can have "blocked" and "blocked_by"

sungwoncho commented 8 years ago

That's a reasonable approach. We could add statuses like was_blocked and did_block. I think this is not an urgent feature because current setup works just fine. This is something to consider in the future improvement. Let's sit on it and wait for more input from the others.

sungwoncho commented 8 years ago

By the way your PR was very helpful. Would you like to be a collaborator for this gem?

Pensarfeo commented 8 years ago

Sure:) It would be fun to keep collaborating in this project