On Thu, Sep 17, 2009 at 3:39 PM, Marnen Laibow-Koser
wrote:
>> Umm yeah, well.. I work in genetics research and I can tell you I have
>> this exact scenario _all the time_.
>
> And you use this sort of data model for it?
Yeah, it turns out two models that share a join model is very common.
--
thanks for all the replies. just to clarify my intent, i am
associating keywords with a set of documents, and the more times a
keyword is associated with particular document, the more it is
weighted as being relevant to that keyword, but it must be the exact
same keyword, that's why i do this:
a
Greg Donald wrote:
[...]
>
> Umm yeah, well.. I work in genetics research and I can tell you I have
> this exact scenario _all the time_.
And you use this sort of data model for it?
> Genetic pathways repeat
> throughout any genome, human or other. Your assumption that
> everyone's data is l
Robert Walker wrote:
[...]
>> a.bs << b
>> a.bs << b
>> a.bs << b
>
> This is somewhat unclear, but it appears from your code this is adding
> the same b three times. So yes, if you did exactly as shown all three
> association to that same b would be deleted.
This appears to be what Dino was a
On Thu, Sep 17, 2009 at 2:36 PM, Marnen Laibow-Koser
wrote:
> The issue here is not the presence or absence of a join model -- after
> all, for a simple habtm, there's no reason at all to introduce the extra
> class. Rather, this is a reflection of the fact that the OP is trying
> to do somethin
dinoD wrote:
>> b = B.first # Find the b you want to remove association to.
>> a.bs.delete(b)
>>
>> From has_and_belongs_to_many doc:
>>
>> collection.delete(object, �)
>> Removes one or more objects from the collection by removing their
>> associations from the join table.
>
> thanks for the rep
Greg Donald wrote:
> On Thu, Sep 17, 2009 at 1:54 PM, dino d. wrote:
>> a.bs << b
>>
>> this creates 3 records in the join table.
>>
>> Is there any way for me to remove only one of these? �I can only seem
>> to remove all of them.
>
>
> This is exactly why I use join models and ignore
> has_an
dino d. wrote:
> a.bs << b
> a.bs << b
> a.bs << b
>
> this creates 3 records in the join table.
>
> Is there any way for me to remove only one of these? I can only seem
> to remove all of them.
b = B.first # Find the b you want to remove association to.
a.bs.delete(b)
>From has_and_belongs_t
> b = B.first # Find the b you want to remove association to.
> a.bs.delete(b)
>
> From has_and_belongs_to_many doc:
>
> collection.delete(object, …)
> Removes one or more objects from the collection by removing their
> associations from the join table.
thanks for the reply, unfortunately this d
On Thu, Sep 17, 2009 at 1:54 PM, dino d. wrote:
>
> hi - i have two models, A and B, and each habtm the other
>
> if I do
>
> a = A.new
> b = B.new
>
> a.bs << b
> a.bs << b
> a.bs << b
>
> this creates 3 records in the join table.
>
> Is there any way for me to remove only one of these? I can
10 matches
Mail list logo