🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.ruby
Article #261

Re: Active Record i problem z prosta relacja

#261
From: simon
Date: Sat, 28 Oct 2006 10:33
37 lines
2154 bytes
Jaroslaw Zabiello napisal(a):
> Mam 2 modele
>
> class DestinationDescription
> ...
> has_many :destinations,
>          :class_name => 'Destination',
>          :foreign_key =>'Destination_ID'
>
> i
>
> class Destination
> ...
> belongs_to :destination_descriptions,
>            :class_name => 'DestinationDescription',
>            :foreign_key=> 'Destination_ID'
>
> Sprawdzam z konsoli:
>
> >> dd = DestinationDescription.find :first
> >> dd.Destination_ID # => 93
> >> d = Destination.find :first, :conditions => 'Destination_ID=93'
> >> d.Destination_ID # => 93
>
> Czyli dane w tabeli maja sens. A teraz najgorsze:
>
> >> dd.destinations # => []
> >> dd.destinations_count # => 0 ZERO!!!
>
> Co tu jest nie tak? Dlaczego nie ma danych?
>

Podeslij dumpy z w/w tabel, bo inaczej to ciezko powiedziec co moze byc
nie tak (rozumiem ze obie klasy dziedzicza z ActiveRecord::Base tylko
nie zaciemniales opisu).

Szymon
Technical Details
Message-ID: <1162031628.676388.46590@i3g2000cwc.googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.task.gda.pl!newsfeed.media.kyoto-u.ac.jp!newsfeed.gamma.ru!Gamma.RU!postnews.google.com!i3g2000cwc.googlegroups.com!not-for-mail
References: <163ry7by917p9.wcavm579lwnu$.dlg@40tude.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.task.gda.pl!newsfeed.media.kyoto-u.ac.jp!newsfeed.gamma.ru!Gamma.RU!postnews.google.com!i3g2000cwc.googlegroups.com!not-for-mail
From: "simon" <szymon.kurcab@gmail.com>
Newsgroups: pl.comp.lang.ruby
Subject: Re: Active Record i problem z prosta relacja
Date: 28 Oct 2006 03:33:48 -0700
Organization: http://groups.google.com
Lines: 38
Message-ID: <1162031628.676388.46590@i3g2000cwc.googlegroups.com>
References: <163ry7by917p9.wcavm579lwnu$.dlg@40tude.net>
NNTP-Posting-Host: 83.29.0.30
Mime-Version: 1.0
X-Trace: posting.google.com 1162031633 16378 127.0.0.1 (28 Oct 2006 10:33:53 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 28 Oct 2006 10:33:53 +0000 (UTC)
In-Reply-To: <163ry7by917p9.wcavm579lwnu$.dlg@40tude.net>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: i3g2000cwc.googlegroups.com; posting-host=83.29.0.30;   posting-account=HkB_tw0AAAAlWBIgGa8zqKA_DeeWc5Zt
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit