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 80
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 62
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 : HTML to XML ---> get title & description
Ask a Rails expert : Accessing controller actions from scripted page?
Ask a Rails expert : seledted option for select_tag
Ask a Rails expert : Merging fields from two tables into one, including duplicates
Ask a Rails expert : saving has_many :through
Ask a Rails expert : Use Rails to develop sites for both Designer and Programmer
Ask a Rails expert : Rails+RS232
Ask a Rails expert : Is this a good way to add Admin section
Ask a Rails expert : RSS feed maker in rails 2.1
Ask a Rails expert : Syncing with ugly legacy databases