๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem z ActiveRecord i belongs_to

#1146
From: BuKoX
Date: Tue, 23 Sep 2008 17:57
32 lines
1953 bytes
BuKoX pisze:

> Witam.
> Tworze pierwszy projekt w RoR wiec prosze o wyrozumialosc. Czytalem 
> dokumentacje ale nie znajduje rozwiazania swojego problemu. Otoz mam 2 
> tabele: user i task. W tabeli task jest klucz obcy responsible_id (do 
> pola user.id). Mam takie modele:
> 
> class User < ActiveRecord::Base
>   has_many :tasks, :foreign_key => "responsible_id"
> end
> 
> class Task < ActiveRecord::Base
>   belongs_to :user, :foreign_key => "responsible_id", :class_name => "User"
> end
> 
> Przy probie dodania nowego rekordu do tabeli user dostaje komunikat: 
> 'undefined method `passwd=' for #<Task:0x415ed6c> czyli tak jakby 
> dodanie rekordu user miaล‚o mieฤ‡ odzwierciedlenie w tabeli task czyli 
> albo cos jest skopane z relacja albo sam juz nie wiem co. Co moze byc 
> powodem?
> 
> PS. Mam pluralize_table_names = false

Juz niewazne. Mialem blad w modelu.

pozdrawiam...

-- 
  __            __     ______________________________           __ ___
|__\ |  | |_/ /  \ \_/  Blog: http://bukox.pl       |    |\ | |_   |
|__/ |__| | \ \__/ / \____TC: http://totalcmd.pl/ _/  <> | \| |__  |
Technical Details
Message-ID: <gbban1$bad$1@inews.gazeta.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.gazeta.pl!not-for-mail
References: <gau9lh$8r6$1@inews.gazeta.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.gazeta.pl!not-for-mail
From: BuKoX <spamerom@mowimy.nie>
Newsgroups: pl.comp.lang.ruby
Subject: Re: Problem z ActiveRecord i belongs_to
Date: Tue, 23 Sep 2008 19:57:49 +0200
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 32
Message-ID: <gbban1$bad$1@inews.gazeta.pl>
References: <gau9lh$8r6$1@inews.gazeta.pl>
NNTP-Posting-Host: 109-mia-7.acn.waw.pl
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1222192673 11597 62.121.74.109 (23 Sep 2008 17:57:53 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Tue, 23 Sep 2008 17:57:53 +0000 (UTC)
X-User: abukox
In-Reply-To: <gau9lh$8r6$1@inews.gazeta.pl>
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit