I don''t think the rollback exception should be caught in this case.
Can
you write a test for us? It seems both transactions should be rolled
back in the case you''ve shown below.
On Tue, May 28, 2013 at 11:30:28AM -0700, ayang99@gmail.com
wrote:> Googling about ''Nested Transactions'' in ActiveRecord
brought me to this github
> issue <https://github.com/rails/rails/issues/3455>.
>
> I''m not sure if there are specific semantics around
''nested transactions''
> I''m not familiar with, but I think I''m in the same place
as sskirby was
> when he opened the issue.
>
> The ActiveRecord Transactions documentation doesn''t explicitly
address what
> in my mind would be the baseline behaviour of nested transactions:
>
> User.transaction do
> User.create(:username => ''Kotori'')
> User.transaction do
> User.create(:username => ''Nemu'')
> raise ActiveRecord::Rollback
> endend
>
>
> Is there any configuration where the nested Rollback *does* indeed cancel
> out itself *and* rollback the parent transaction?
>
> Specifically, we have model classes, model1 and model2 that have their own
> respective save methods. I''d like to combine several of them into
a single
> transaction called from say a controller.
>
> Thanks,
> Andy
>
> --
> You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to rubyonrails-core+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
Aaron Patterson
http://tenderlovemaking.com/
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to rubyonrails-core+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.