views:

96

answers:

4

I'm currently building a "Lifesteam" style website in Rails. A lifestream usually is an aggregate of public content (usually received via APIs).

I'm currently confused about the database structure.

There will be a Users table (as users will be able to sign up and have their own lifestream). I'm wondering whether I should also have a Services table, or have a table for each of the services (Twitter, Delicious etc.) or both. I'm also wondering how these tables would be linked together.

If there was a resource for each service, would it be possible that these somehow inherit from a single Service resource?

Any insight would be a great help, Thanks.

A: 

May be use separate table for each service each having a user_id in it. Then they can be automatically linked by the user_id.

Webbisshh
Is there a way of having these services somehow inherit from a single model or table? So I could call Services.all, rather than call each service independently.
Sam Nardoni
A: 

I would probably steer clear of separate tables for each service since it makes it rather difficult to extend the service in the future.

I would be tempted to have a services table which also links to a service_type table. The service type could be RSS or whatever other feed you might support.

Add Feedzirra (http://github.com/pauldix/feedzirra/tree/master) and you're away.

askegg
A: 

I'd use a generic table to handle services in order to make adding a new service easier. You can then handle specificities with extra fields, but in the end services won't be that different from one another.

marcgg
A: 

A generic table to handle services world be great. You can user inheritance to specialize each service.