[Nitro] Is there a reason I shouldn't want to do this?

George Moschovitis george.moschovitis at gmail.com
Fri Feb 9 03:34:37 EST 2007


You should propbably be using single table inheritance. Have a look at
tc_sti.rb, tc_inheritance.rb etc for more details.
However, at the moment sti seems to be buggy (after the latest Og changes).
I will have a look at this tomorrow or something.

regards,
George.

On 2/9/07, nyarly at gmail.com <nyarly at gmail.com> wrote:
>
> class Target
>   attr_accessor :thing, String
>   def initialize(t); thing=t; end
> end
>
> class SubTarget < Target
>   attr_accessor :another_thing, String
>   def initialize(t, a_t); super(t); another_thing = a_t; end
> end
>
> class Owner
>   has_many :targets, Target
> end
>
> o = Owner.new
> o.add_target(SubTarget.new("one", "two"))
>
> At present, this creates three tables, with a foreign key from
> og_target to og_owner, and the SubTarget gets lost because the select
> is against the og_target table.
>
> Is there a philosophy here that I'm not understanding?
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>



-- 
http://blog.gmosx.com
http://cull.gr
http://www.joy.gr
http://nitroproject.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20070209/40242bb5/attachment.html 


More information about the Nitro-general mailing list