Heinz Strunk wrote:
> First of all thank you guys! I think what Valentin wrote is just what I
> was looking for. Person, Car, Truck was just an example. It's a lot more
> complexe in my application and you can't just merge these two different
> models into one and add a :type.
>
> I'll do it l
First of all thank you guys! I think what Valentin wrote is just what I
was looking for. Person, Car, Truck was just an example. It's a lot more
complexe in my application and you can't just merge these two different
models into one and add a :type.
I'll do it like Valentin suggested. Thanks a
I'm not sure of what you need to do but I'll assume that you just want
to create an association between a person and a vehicle of type car or
truck (or whatever).
I am assuming that you have STI built into your vehicles table, with a
column named 'type' that stores the type of vehicle
('Car'/'Tru
I think that you should create some kind of an interface, for example
Vehicle, like this:
class Vehicle < ActiveRecord::Base
belongs_to :person, :polymorphic => true
end
After that you should make the inherited models Car and Truck:
class Car < Vehicle
end
class Truck < Vehicle
end
and fina
4 matches
Mail list logo