Error deleting object with has many relationship

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:ininitialize’
vendor/rails/activerecord/lib/active_record/associations.rb:1032:in
new' vendor/rails/activerecord/lib/active_record/associations.rb:1032:infiles’
vendor/rails/activerecord/lib/active_record/callbacks.rb:309:in
callback' vendor/rails/activerecord/lib/active_record/callbacks.rb:309:incallback’
vendor/rails/activerecord/lib/active_record/callbacks.rb:304:in each' vendor/rails/activerecord/lib/active_record/callbacks.rb:304:incallback’
vendor/rails/activerecord/lib/active_record/callbacks.rb:294:in
destroy_without_transactions' vendor/rails/activerecord/lib/active_record/transactions.rb:104:indestroy’
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
transaction' vendor/rails/activerecord/lib/active_record/transactions.rb:80:intransaction’
vendor/rails/activerecord/lib/active_record/transactions.rb:100:in
transaction' vendor/rails/activerecord/lib/active_record/transactions.rb:104:indestroy’
app/controllers/employees_controller.rb:131:in destroy' -e:4:inload’
-e:4

Anyone got any ideas?

JB

On Jul 4, 8:53 pm, John B. [email protected]
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