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

On Jun 29, 11:25 am, Ram <yourstruly.vi...@gmail.com> wrote:
> Anyone? ideas? i really am not able to figure this out.. nothing in
> the API docs, google is not being its dependable self..
>
> On Jun 27, 11:58 am, Ram <yourstruly.vi...@gmail.com> wrote:
>
> > Hi all,
>
> > I have two models Order and Transaction witht he following
> > relationship.
>
> > Order
> > has_one :transaction
> > Transaction
> > belongs_to :order
>
> > and there's an order_id column in the transactions table. These models
> > have various associations with other models too.
>
> > When i try to delete an order though, it does not get deleted. When i
> > comment out the association line in the model 'has_one :transaction',
> > the delete works fine. Its puzzling! There are no before_destroy
> > callbacks on either model yet the log shows this line
>
> > SELECT * FROM `transactions` WHERE (`transactions`.order_id = 80)
> > LIMIT 1
>
> > this is the last line in the log. The order is not deleted and neither
> > is the transaction. Any idea what im doing wrong?
> > oh and i tried adding :dependent => :destroy on the :has_one too. That
> > dint work either.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to