Search code examples
ruby-on-railsactiverecordmetaprogrammingruby-on-rails-2

Unable to find save_without_transactions method


We are upgrading a gem(graph_mediator) which depends on activerecord 2.3.18. The gem is adding some custom behaviour before and after saving model.

We came across following methods which are not obsolete in newer versions of Rails:

  1. save_without_transactions
  2. save_without_transactions!

In order to make it work with newer version of rails we need to understand these methods. We search for these methods in Rails 2.3.18 code-base but couldn't find anywhere. However we could find two methods which are calling these methods but not able to understand the purpose and actual definition of each above methods.


Solution

  • From the source we could find how the method is dynamically created via alias_method_chain.

    The save_without_transaction is actually alias of save.