How social_stream register new user works (using devise gem)?

543 Views Asked by At

I'm trying social_stream gem (https://github.com/ging/social_stream). It uses devise gem for user registration. When I register a new user on social_stream, it creates new records in several tables. I checked the code in social stream, the registration method is not overrided. So I'm totally lost. I can't find how new records are inserted in the other tables except user table. There are several new records inserted into the following tables: channels, actors, profile, activity_objects, relations, permissions. But I can't find the connection between users to these tables.

Can anyone help me to point out how social stream works when new user register?

Thank you

2

There are 2 best solutions below

1
On

Have a look at the database schema to get a glimpse of the architecture (and complexity) of social stream.

I may be wrong, but as social stream is based on device, it's devise that handles the user registration (check devise/app/controllers/devise/registrations_controller.rb). You might want to move that into your app to override this behavior.

Given the overall complexity of social stream, think twice before building your project on top of it.


Pros for using it:

  • You have a deep knowledge of rails and engines, so you can customise it easily
  • You can understand the code of others, and complex models easily (so you will actually understand what's going on under the covers)
  • Or you just want to prototype and then throw your project away

Cons:

  • You need just a few social stream features (eg, just user registration and adding friends)
  • You are on a long term project
  • You don't have much rails experience
1
On

You can see on User model ( https://github.com/ging/social_stream/blob/master/base/app/models/user.rb#L8 ) there are several has_many association.

In the find_or_create_for_facebook_oauth method there are a User and Authentication method create.

https://github.com/ging/social_stream/blob/master/base/app/models/user.rb#L118