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.....?* Thank you vishnu -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/i2NkV2Mw9YUJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.