[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Rails: has_many issue

treefrog

2/6/2006 12:41:00 PM

Hi,
I'm trying to work out how to tackle a particular problem in rails.

I have some data. A lot of data (well not NSA style a lot of data, but
a lot for me: 1Gb at the moment, more to come).

I'm building a ruby application to process and view this data, and have
been working round using rails as a front end - do the heavy lifting
using some maths libraries, then use rails to display results, etc.

The problem that I have is as follows: The natural organisation is that
the data consists of DataSets, each DataSet is a group of related time
series (Series), and each series consists fo a set of observations,
each Observation having a set of parameters.

So far, so good. The logical layout of the data is something like

DataSet has_many Series
Series has_many Observation

The problem is that I need to be able to do processing of the data
offline at a later point, and one of the thngs I am doing is developing
new ways of dealing with the data. So I need to apply a transformation
to each Observation. The transformed data hasn't lost anything, and it
still comes in Series which belong to a dataset.

One option would be

DataSet has_many Series
DataSet has many TransformedSeries
Series has_many Observation
TransformedSeries has many TransformedObservation

but the problem is that every time I add a new transformation, I need
to change my DB schema, etc, and add new code in to DataSet - which I
personally believe is quite ugly!

What I would really like is for the Series to have a field
(series_type) which contains the name of the table to look up the
Observation in. So, depending on the value in the series_type field,
Series would perform has_many operations using the Observation table or
the TransformedObservation table (or whatever other table).

Is there any easy way to achieve this without directly hacking
has_many?

Best regards,

Treefrog

2 Answers

Eric Hodel

2/6/2006 7:41:00 PM

0

On Feb 6, 2006, at 4:43 AM, treefrog wrote:

> Hi,
> I'm trying to work out how to tackle a particular problem in rails.

You should use the Rails mailing list then.

http://lists.rubyonrails.org/mailman/list...

--
Eric Hodel - drbrain@segment7.net - http://se...
This implementation is HODEL-HASH-9600 compliant

http://trackmap.rob...




Ron Hamilton

8/11/2009 12:54:00 AM

0

stupid *impotent* cheeselog lied:
> On Mon, 10 Aug 2009 07:03:04 -0700, Wilson Woods
> <banmilk@hotmail.com> wrote:
>
>> stupid *impotent* cheeselog lied:
>>> On Sun, 09 Aug 2009 20:40:56 -0700, Wilson Woods
>>> <banmilk@hotmail.com> wrote:
>>>
>>>>> You moron---you don't even know why the revolution
>>>>> happened.
>>>> I do. You, you stupid dimwitted plodding douchebag, do not.
>>> By what evidence?
>> Your posts, fuckwit.
>
>
> So---you're saying by "my posts" you know why the
> revolution was fought?

No, douchebag. I said "You, you stupid dimwitted plodding douchebag, do
not [know why the Revolution was fought]." You asked, "By what
evidence?" And I answered: "Your posts, fuckwit." It is by your
posts, you fuckwit, that I know you don't know why the Revolution was
fought. You don't know history, you don't know politics, you don't know
economics, you don't know the law. You don't know a fucking thing
except your leftist indoctrination. You're stupid and plodding.