You are here: Forums Ask a Rails expert [NewBie] Ask About ActiveRecor...
Posted in Forums : Ask a Rails expert
Authority 0
Posting Rating 0
Sign in to rate this post
|
Dear Buddies: Could any one help me to explain what is it for: [1] ActiveRecord::Base.transaction and Model_name.transaction ? [2] What is deferences ActiveRecord::Base.transaction and [3] Is it the same like Transaction Support? [4] Any one can give me proof of concept of Thank you very much for your time and help. Best Regards, |
Authority 37
Posting Rating 85
Sign in to rate this post
|
There is no difference between ActiveRecord::Base.transaction and ModelName.transaction. Your models extend the ActiveRecord::Base class and inherit the transaction method. The implementation is thus exactly the same. The method is indeed transaction support as you can read in the API. Here you can also find some examples of usage of this method. |
Authority 37
Posting Rating 95
Sign in to rate this post
|
You also need to check that your database engine actually supports transactions – for MySQL, for example, you should use the InnoDB type (which is the default in Rails anyway). Also worth mentioning: Rails, by default, does some transactions by itself if you’re using collection proxies (e.g. post.comments.create, etc.). |
Ask a Rails expert : Tracking down an issue
Ask a Rails expert : Thread Vs Transaction
Ask a Rails expert : implementing whitelist plugin
Ask a Rails expert : Validation helper
Ask a Rails expert : FILE EDIT/DELETE
Ask a Rails expert : decrypting the password
Ask a Rails expert : Static Objects in Rails
Ask a Rails expert : Newbie - Rake Cant Execute Test
Ask a Rails expert : Call Web service
Ask a Rails expert : RMagick issues