Browse the Ruby on Rails Community.

You are here: Forums Ask a Rails expert [NewBie] Ask About ActiveRecor...

Replytotopic

[NewBie] Ask About ActiveRecord::Base.transaction

Posted in Forums : Ask a Rails expert

 
Untitled-1d

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
Model_name.transaction ?

[3] Is it the same like Transaction Support?

[4] Any one can give me proof of concept of
ActiveRecord::Base.transaction ?

Thank you very much for your time and help.

Best Regards,
Reinhart

 
Profile

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.

 
Me

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.).

Replytotopic

Other Recent Topics

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

Formatting Help
  • *bold*       _italics_      
    bq. (quotes)
  • "DSC":http://www.dsc.net
  • * or # (lists)
or cancel