Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Improve Project creation. #23

Open
richardkmichael opened this issue Sep 2, 2011 · 2 comments
Open

Improve Project creation. #23

richardkmichael opened this issue Sep 2, 2011 · 2 comments

Comments

@richardkmichael
Copy link
Owner

Really?

Should we implicitly make the project-creating-user a collaborator?

What about a user creating a project who is not a collaborator on THAT same project? (Should this be possible?)

UUID auto generation

This is not the Rails Way(tm). Except I don't like binding model logic to persistence with hooks.
Possibly fix with after_initialize() ; if new? ... ; end

See: The Rails 3 Way, page 308. It's called after each DB load. :/

@franckverrot
Copy link
Collaborator

No sure i'm getting this (i wont open right now the R3 way i'm about to.. take a NAP!), but don't use too much after_initialize. The reason behind this is that when you do user = User.first, user.initialize is never called. Instead, AR will call user = User.allocate, then use instance_variable_set on @attributes, and finally fire-off the callbacks.

So after_initialize would only work when you do User.new (and so, new? will always be true in this method)

@richardkmichael
Copy link
Owner Author

That's OK, the UUID should only be generated on p = Project.new(...). I read about this to insure it only happens then, in fact.

I'll read about more details when get around to updating this. Related to hooks, I have to review the details of Model.create and Model.save.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants