[Nitro] Og Self-Interaction Question

Matthew B Gardner weather at speakeasy.net
Wed Dec 12 22:30:28 EST 2007


Hello --

On Wednesday 12 December 2007 05:56, Trans wrote:
> On Dec 12, 1:49 am, Matthew B Gardner <weat... at speakeasy.net> wrote:
> > Hello --
> >   I'm writing a game which uses Og with MySQL, and I want my website to
> > be able to interact with that data as well. I'm wondering about solutions
> > to this problem:
> >
> > Game...
> >
> > class HelpFile
> >         property :name, String
> >         property :body, String
> >         property :viewed, Integer
> > end
> >
> > Web...
> >
> > class HelpFile
> >         attr_accessor :name, String
> >         attr_accessor :body, String, :control => :textarea
> > end
> >
> > The web class doesn't need the viewed attribute, but I'm assuming it'll
> > drop that attribute from the database if it isn't declared. Likewise, I'm
> > sure there will be web-data that I won't need in the game. I know I could
> > disable full evolution, but I'd like to not have to do that...especially
> > since I think that's one of the best reasons to use Og with my project
> > (changing to add might not be too terrible). Maybe using two different
> > declarations of essentially the same class isn't even good practice, but
> > the game class having access to web-based methods and vise-versa seems
> > problematic to me (not to mention the classes are in two different
> > places).
> >
> > Does anyone have some insight on this? Implementation solutions?
>
> Seems reasonable that you could define a single base class for the
> table then two subclasses that act as "views". If sub-classing does
> not provided a means for  avoiding the evolution then just delegate --
> which certainly will work.
>
> T.

Thanks for the ideas -- could you expand on what you mean by delegate though?

Thanks again,
Matt


More information about the Nitro-general mailing list