That's why I suggested after_create, the user is already created and in the 
DB with a definite id.

after_create :add_default_models

def add_default_models
  # some code here using self.id (user model) wherever need the owning id.
end

Alternatively (and maybe better) is if you're using the lifecycle signup 
action you can put the model creation code there.

As far as passing the id in, most of the AR DB calls will accept an array 
where you'd normal think of a string that it properly SQL escapes to avoid 
injection attacks (not really a concern in this case since the id isn't 
something the end user can alter).

An example of use for a conditions: 

:conditions => ["owner_id = ?",self.id]

The string is a sql fragment that has each ? replaced with the next value of 
the array down the line.  You need to supply a value for each ? even if 
they're all the same.

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/hobousers/-/o3HcLpW9fqIJ.
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/hobousers?hl=en.

Reply via email to