Consider the following:

class Base
   class_inheritable_accessor :value
end
Base.value = SomeActiveRecordClass
class Concrete < Base; end

Reasonable enough. Concrete.value.find will die horribly, because  
Concrete.value.table_name is the empty string.

I believe this is because in class_inheritable_accessor we dup the  
values, in this case SomeActiveRecordClass/
  The duped class isn't assigned to a constant and so has no name (at  
least on ruby 1.8.6), and since we derive table names from class names  
we're boned. (unless SomeActiveRecordClass had already set its table  
name).

Storing classes like this isn't really a great idea idea anyway  
(because of class reloading in dev mode) but it seems the duping  
classes like this isn't really necessary, and could lead to hard to  
diagnose problems

Making it not dup classes seems to fix the problem, but I wondered if  
someone who knows this corner of ActiveSupport could cast any extra  
light?

Fred

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to