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 100
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 : How to use mephisto
Ask a Rails expert : How to use mephisto
Ask a Rails expert : will_paginate customization problem
Ask a Rails expert : BackgroundRB still wants 'development' environment...?
Ask a Rails expert : activescaffold, sql exception
Ask a Rails expert : Passing non-english chars in query string
Ask a Rails expert : Rails and 2D barcodes
Ask a Rails expert : apache giving proxy error
Ask a Rails expert : Custom Responses w/ 'extra' information...?
Ask a Rails expert : Log rotation in rails