If i do Order has_one :txn, :class_name => "Transaction"
things work just fine. But i still dont get how the line in New Relic's agent generates that query.. Gonna let them know.. On Jun 30, 12:58 pm, Ram <yourstruly.vi...@gmail.com> wrote: > The query comes from > > vendor/plugins/newrelic_rpm/lib/new_relic/agent/instrumentation/ > active_record_instrumentation.rb:40:in > `log_without_trace_Database___adapter_name____args_1__' > > New Relic's agent. hmm.. maybe not a good idea to have 'transaction' > as a model name? > > On Jun 30, 12:39 pm, Ram <yourstruly.vi...@gmail.com> wrote: > > > Hi Colin, > > > It never gets to the delete sql at all. There is no delete sql in the > > log. There is a 'select' on transaction which i cant figure out how. > > > the log o/p > > > Parameters: {"action"=>"destroy", "_method"=>"delete", > > "authenticity_token"=>"2c84880c410eab07f8ed9125520c50e440eb3105", > > "id"=>"80", "controller"=>"orders"} > > ... > > [4;36;1mOrder Columns (0.003615) [0m [0;1mSHOW FIELDS FROM > > `orders` [0m > > [4;35;1mOrder Load (0.002041) [0m [0mSELECT `orders`.* FROM > > `orders` INNER JOIN users ON orders.user_id = users.id WHERE > > (`orders`.`id` = 80) [0m > > [4;36;1mTransaction Load (0.001054) [0m [0;1mSELECT * FROM > > `transactions` WHERE (`transactions`.order_id = 80) LIMIT 1 [0m > > Redirected tohttp://localhost:3000/orders > > ... > > > What ive figured out so far is that @order.destroy returns whatever > > "SELECT * FROM `transactions` WHERE (`transactions`.order_id = 80) > > LIMIT 1" returns. > > My model definitions couldnt possibly be simpler. Its as ive defined > > them above.. just cant figure it out.. any ideas at all? doesnt seem > > to be any ticket on it in Lighthouse.. could it?.. indeed.. be.. a... > > BUG!!?!? > > Im gonna try and install the query trace plugin and trace where that > > query is coming from... > > any other ideas? > > > On Jun 30, 12:27 pm, Colin Law <clan...@googlemail.com> wrote: > > > > 2009/6/29 Ram <yourstruly.vi...@gmail.com>: > > > > > Whats interesting is that if there is no transaction for a particular > > > > @order, then @order.destroy fails. But if there IS a transaction for > > > > the given @order, then @order.destroy returns true but the order is > > > > still there. It doesnt get deleted!! WEIRD! > > > > > And the logs carry the same queries.. no difference. > > > > I have another has_one association on the same Order model but that > > > > doesnt give me any of this pain.. i just dont get it.. > > > > Have you tried running the (failed) delete sql manually in phpmyadmin > > > or whatever to see if it works then? > > > > 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 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 -~----------~----~----~----~------~----~------~--~---