Ok - I might be complicating too much.

Heres how I would do it with c++, not 100% sure what approach should I 
take with rails on the database/model level.

If I want to have generic data-storage model Vehicle (which will hold 
information the same information for all the vehicles - car, boat, etc.)

class vehicle holds:
color, max-speed, ..

class car:
color, max-speed, number of seats, ..

class boat:
color, max-speed, ... with some boat-specific columns

I'd just derive car from vehicle and use car-specific data columns 
because similar operations will be called on it as on boat model.

As far as I understand RoR approach: if I have a lot of duplicated code 
in my application, there must be some better solution for my problem.

What do you think?


Marnen Laibow-Koser wrote:
> Aljaz Fajmut wrote:
>> It might not be the best example but I couldnt think of better one in 
>> the moment in wrote this. I have a clear image of what I want to 
>> implement.
> 
> Then you should be able to explain it more clearly. :)
> 
>> 
>> Is this single or multi-table inheritance?
> 
> They're functionally more or less equivalent, although single-table 
> inheritance is rather a perversion of the relational model.  The choice 
> between the two usually seems to be made on practical grounds.
>> 
>> Thanks for help
>> 
>>
> 
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> [email protected]

-- 
Posted via http://www.ruby-forum.com/.

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