From: Logan Capaldo Date: 2006-07-21T11:59:05+09:00 Subject: Re: Problem when 'loading' a file containing a class derived from a struct On Jul 20, 2006, at 5:27 PM, Chris Roos wrote: > I actually spotted this in a rails app but traced it back to ruby. Is > this a real problem/bug or am I missing something obvious? > > $ cat > person.rb > class Person < Struct.new(:forename, :surname) > end > $ irb > irb> load 'person.rb' > => true > irb> load 'person.rb' > TypeError: superclass mismatch for class Person > from ./person.rb:1 > from (irb):2 > > This behaviour has been experienced with both ruby 1.8.2 and 1.8.4. > > Chris > Hence to use this with rails which will reload stuff like it's going out of style: Person = Struct.new(:forename, :surname) class Person # optionally add methods here end