This might be a painfully bad idea, but it’s gotten me curious. I have
a generic object Node, which has a name attribute. Say for example that
one of the names is “Widget”.
What I’m wondering is, is there a way to manipulate ActiveRecord to make
a class named Widget, that behaves exactly like a Node with the only
difference being that all operations only work on the condition
(name=“Widget”) is true? I can do a simple class Widget < Node to
get it started, but I’m looking for what the next line would be, where I
can specify the global condition. In all other cases,
History : The database itself is generated rather, well, generically by
scanning a file where I don’t know the nature of the content beyond
simple node relationships (i.e. I don’t know ahead of time all values
for “name”). However, I’m thinking that after the flat data storage
portion is taken care of I could go in and maybe write some sort of
generator for myself that would build up the Ruby classes to deal with
the database, and hide the whole thing.
You know, that might be exactly it. I knew I’d heard it somewhere
before :).
Thanks! Sorry for the interruption.
D
Duane M. wrote:
This might be a painfully bad idea, but it’s gotten me curious. I have
a generic object Node, which has a name attribute. Say for example that
one of the names is “Widget”.
What I’m wondering is, is there a way to manipulate ActiveRecord to make
a class named Widget, that behaves exactly like a Node with the only
difference being that all operations only work on the condition
(name=“Widget”) is true? I can do a simple class Widget < Node to
get it started, but I’m looking for what the next line would be, where I
can specify the global condition. In all other cases,
History : The database itself is generated rather, well, generically by
scanning a file where I don’t know the nature of the content beyond
simple node relationships (i.e. I don’t know ahead of time all values
for “name”). However, I’m thinking that after the flat data storage
portion is taken care of I could go in and maybe write some sort of
generator for myself that would build up the Ruby classes to deal with
the database, and hide the whole thing.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.