Hi, Im getting this strange error when trying to delete an employee, im guessing its something to do with one of the has_many relationships but how do i know which one. ndefined method `table_name'' for File:Class vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb:152:in `construct_sql'' vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb:6:in `initialize'' vendor/rails/activerecord/lib/active_record/associations.rb:1032:in `new'' vendor/rails/activerecord/lib/active_record/associations.rb:1032:in `files'' vendor/rails/activerecord/lib/active_record/callbacks.rb:309:in `callback'' vendor/rails/activerecord/lib/active_record/callbacks.rb:309:in `callback'' vendor/rails/activerecord/lib/active_record/callbacks.rb:304:in `each'' vendor/rails/activerecord/lib/active_record/callbacks.rb:304:in `callback'' vendor/rails/activerecord/lib/active_record/callbacks.rb:294:in `destroy_without_transactions'' vendor/rails/activerecord/lib/active_record/transactions.rb:104:in `destroy'' vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'' vendor/rails/activerecord/lib/active_record/transactions.rb:80:in `transaction'' vendor/rails/activerecord/lib/active_record/transactions.rb:100:in `transaction'' vendor/rails/activerecord/lib/active_record/transactions.rb:104:in `destroy'' app/controllers/employees_controller.rb:131:in `destroy'' -e:4:in `load'' -e:4 Anyone got any ideas? JB -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jul-04 20:28 UTC
Re: Error deleting object with has many relationship
On Jul 4, 8:53 pm, John Butler <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > Im getting this strange error when trying to delete an employee, im > guessing its something to do with one of the has_many relationships but > how do i know which one. >Random guess: it''s the one called files. That makes rails load up File, but oh no, it''s found ruby''s File class, which isn''t an activerecord class and hence doesn''t respond to table_name. Fred --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---