i found these:
http://wiki.rubyonrails.com/rails/show/HowToUseTransactions
http://ar.rubyonrails.com/classes/ActiveRecord/Transactions/
ClassMethods.html
if you havent seen them
D
On 21/03/2005, at 11:43 PM, Joe Noon wrote:
> Im hoping someone can push me in the right direction as I dive into
> rails. I am trying to lose the bad habits of php/mysql and start
> working with postgres and transactions.
>
> I have 2 models, a users model and details model. The users table
> contains the basics, while the details table contains extra fields for
> a
> particular user. user_id is a foreign key to the users table. I have
> both models on one form, so when it is submitted I want the users query
> to dictate the user_id for the details table. Here is how I am
> currently doing this with the session:
>
> def signup
> case @request.method
> when :post
> @user = User.new(@params[''user''])
>
>
> if @user.save
> @session[''user''] =
User.authenticate(@user.login,
> @params[''user''][''password''])
> end
>
> @params[''detail''][''user_id''] =
@session[''user''][''id'']
> @detail = Detail.new(@params[''detail''])
>
> if @detail.save
> flash[''notice''] = "Signup
successful"
> redirect_back_or_default :action => "welcome"
> end
> when :get
> @user = User.new
> @detail = Detail.new
> end
> end
>
> This works fine for getting familiar with rails, but I would like to be
> able to do this in a transaction so I could cut out the need for the
> session lookup and leave as much of the business logic in postgres as
> possible. I also wouldnt want a user record hanging around if
> something
> didnt go right with the detail record, etc etc
>
> Im hoping someone can show me the light!
>
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>