Hi,

I have a Modul model and a Role model. Each modul can have many roles.
So when the modul is deleted, it should delete the roles also.
I have the following in my Modul model:

has_many :roles, :dependent => :destroy

When i run  some_object.destroy from the console, i get the following
error:

ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'id' in
'where clause': DELETE FROM `roles` WHERE `id` = NULL
        from C:/rubyonrails/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.3.3/lib/active_record/connection_adapters/abstract_ada
pter.rb:212:in `log'
        from C:/rubyonrails/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.3.3/lib/active_record/connection_adapters/mysql_adapte
r.rb:320:in `execute'
        from C:/rubyonrails/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.3.3/lib/active_record/connection_adapters/abstract/dat
abase_statements.rb:265:in `update_sql'
        from C:/rubyonrails/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.3.3/lib/active_record/connection_adapters/mysql_adapte
r.rb:335:in `update_sql'
        from C:/rubyonrails/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.3.3/lib/active_record/connection_adapters/abstract/dat

Does anyone have any idea?

Thanks,
Pratik
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to