Use require_dependency to load subclasses.

# product.rb
class Produtct < AR::Base
end
require_dependency 'book'
require_dependency 'movie'

# movie.rb

class Movie < Product
end

# book.rb

class Book < Product
end


This way it will work in development and production environment + code
reloading will work fine.

Another solution is to keep list of class names in database (aka
'dictionary' table), retrive it and constantize those names.

Robert Pankowecki
http://robert.pankowecki.pl

-- 
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