Thanks for pointing to after_initialize, your point 2 is very valid. About
point 1, everything is wrapped automatically in a transaction by Rails and I
have tests for it. Is that not the case (and my tests are passing due to the
magic of the universe or something?).
My problem is a little bit more complex, as both users and people are in
tenant, my code looks like this:
def create_person
if person_id.nil? && person.nil?
self.person = Person.new
self.tenant.people << self.person
end
end
The problem is that in after_initialize, self.tenant is still nil.
--
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/-/x1QO3wjWSGcJ.
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.