On 11/26/06, Giant Cranes
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> Hi,
>
> Is it possible to run a model callback under the scope of a transaction?
> I would like to update a ''Tags'' table every time a
''Post'' is edited,
> clearing and then creating some tags automatically (author, some
> keywords, date etc).
>
> I currently have a ''after_save :update_tags'' callback in
the post model,
> but this is currently not running under a transaction.
>
No? Read the api docs for ActiveRecord::Transactions::ClassMethods one
more time. Yup, the ActiveRecord::Callbacks page could use a note
about this as well.
If your callbacks really aren''t wrapped in a transaction, make sure
your "database" is using innodb tables, or better yet; switch to
Postgres.
Isak
> Perhaps I am going about this in the wrong way?
>
> Any help or insight is much appreciated.
>
> Thanks,
> GiantCranes
>
> --
> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---