On 1 February 2012 07:56, amvis <[email protected]> wrote: > > tran > =Transaction.select("transactions.id,transactions.user_id,transactions.branch_id,transactions.customer_id,transactions.membership_type_id,transactions.bill_amount,transactions.bill_date") > treport = TransactionReport.new > puts "from report" > tran.each do |u| > bs = TransactionReport.new( > :user_id => u.user_id, > :branch_id => u.branch_id, > :transaction_id => u.id, > :customer_id => u.customer_id, > :membership_type_id => u.membership_type_id, > :bill_amount => u.bill_amount, > :bill_date => u.bill_date > ) > bs.save > > Here the object creation will happen in loop so this will create new object > for TransactionReport with each insertion. How to avoid this in rails3.....?
Exactly what is it that you are trying to avoid? If you don't want it to create new objects in the loop then just remove the code. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

