Hello.
I've read about examples on inheritance with rails.
Here is an example:

http://juixe.com/techknow/index.php/2006/06/03/rails-single-table-inheritance/

The way is to add a type field in the table.
So if I have an Animal class with an attribute name, I can inherit
from this class like:

Dog < Animal, Cat < Animal, and so on.

With the type field in the table I can do Dog.all, Cat.all having
automaticaly all dogs, all cats, etc.
But what if I want to add some other attributes to Dog or Cat classes?
In the example above all classes have only name attribute.
What if I want inherit from Animal extending attributes and adding,
for example, an attribute like canFly? for inherited classes?

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to