Ruby on Rails Saturday, September 1, 2012

Hi

Is there a method to create child objects after a parent object has been
created?

eg i have a process class, which when created should contain at least 1
digram class.

I have looked at the initialize method but not sure when this is invoked
ie when an object is created (ie saved to db) or everytime an object is
instantiated (ie read from db).

I only want to invoke the method to create child object the first time
parent object is saved to the db.

I suppose this is like a transaction (ie both records need to be saved
or none), but again not sure how this is implemented in rails.

Thanks in advance :)

Jase

--
Posted via http://www.ruby-forum.com/.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment