my rudimentary understanding... you need these all to be has_many :through
relationships and you need only one person model and new relationship
models to account for privileges.

user
has_many organizations, through memberships

organization
has_many users, through memberships

membership
belongs_to user
belongs_to organization

same with blogs and members with subscriptions being the through
relationship.

importantly, then the blog has many editors through privileges, with editor
pointing back to the member table and privileges belonging to a user/editor.

in this way you allow subscribers to be promoted to a blog editor and
editors being demoted to a plain subscriber without having duplicate
database tables. you just edit their privileges, not destroy an editor and
create a subscriber. very clean.

in short, you need RELATIONSHIPS tables and NOT more people tables. this as
I understand things is a huge part of cleaning up your domain.

this will give you:
user.organizations
organization.users
blog.subscribers
blog.editors
blog.organization
etc. etc.

jordan



On Jan 16, 2012, at 9:48 PM, Aline de Oliveira Freitas <
[email protected]> wrote:

Mr. El-Husseini.
I'm also new to Rails Dev, so my opinion is kind of imature, but for this
instant, I really believe you should NOT be worring about those issues. If
I were you, I would first focus on worring about getting my app to work
properly, according to my specifications, strenghening my Object's
Relationships. Once that's working as it should, THEN I would worry about
authentication, permissions, subdomains and stuff.

Trust me, It will be a lot of hard work for you to reach the level of "Ok,
there I go. My app is working smoothly and well tested. That's what I was
talking about when I decided to start this whole thing up." So focus on
what's right in front of you, the basis of your rails app.

And then go through this path of "Wow, what the heck. Regular users should
NOT be able to reach organization's settings and stuff. I need to restrain
that"

See what I mean? Developing is like polishing a jewelry to a client. It's a
really delicate art, and that you don't start it by trying to do it
perfectly at the first try. No, you need to lapidate that rough diamond
into a elegant, delicate and beautiful jewelry. Make your sketch, and then
lapidate your app until your rough app, becomes an awesome, robust, secure
and consistent app!

Sorry If I got a little carried away, but. That's my advise :)

2012/1/16 Mohamad El-Husseini <[email protected]>

> Newbie learning Rails and about to undertake my first real app. Please
> bare with me, I'll try not to be long winded.
>
> It's a blogging app where blogs belong to organizations, not users. An
> organization can have many blogs, a blog can have many admins, and many
> subscribers. There can be many organizations.
>
> My many objects are: Organization, User, Blog, BlogSubscription (this is a
> joiner table association a blog with a user)
>
> An Organization has many blogs and belongs to a user
> A User has many BlogSubscriptions and (has one or has many--yet to be
> decided) organizations
> A Blog belongs to an organization
>
> I'm thinking of having two sign up processes. A) for organizations, B) for
> ordinary users who subscribe to blogs
>
> So for sign-up A: User signs up and the app creates the user object and an
> Organization object attached to the user. This is an account-level object.
> For sign-up B: User finds a blog and subscribes, or signs-in/signs-up then
> subscribes. This is a user level object.
>
> I'm afraid that the way I plan to go about might give me a headache. Areas
> of concern:
>
> 1. Roles. How to implement role based security and authorization.
> 2. Login. Should I roll my own or use something like Devise with OmniAuth
> 3. Organization level subdomain. So James signs up and creates an
> Organization, which should map to smiths.myapp.com
>
> The closest real life app I can think of is UserVoice. I would appreciate
> any guidance, tips, or resources by anyone who has some knowledge or
> experience developing a similar app. I'm having a particularly hard time
> modeling my data.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/GqhiH9cd7iIJ.
> 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/rubyonrails-talk?hl=en.
>

 --
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to