Article View: pl.comp.lang.ruby
Article #1147Problem z ActiveRecord i belongs_to
From: BuKoX
Date: Thu, 18 Sep 2008 19:20
Date: Thu, 18 Sep 2008 19:20
29 lines
1831 bytes
1831 bytes
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 pozdrawiam... -- __ __ ______________________________ __ ___ |__\ | | |_/ / \ \_/ Blog: http://bukox.pl | |\ | |_ | |__/ |__| | \ \__/ / \____TC: http://totalcmd.pl/ _/ <> | \| |__ |
Technical Details
Message-ID:
<gau9lh$8r6$1@inews.gazeta.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!newsfeed.silweb.pl!newsfeed.pionier.net.pl!news.gazeta.pl!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!newsfeed.silweb.pl!newsfeed.pionier.net.pl!news.gazeta.pl!not-for-mail From: BuKoX <spamerom@mowimy.nie> Newsgroups: pl.comp.lang.ruby Subject: Problem z ActiveRecord i belongs_to Date: Thu, 18 Sep 2008 21:20:03 +0200 Organization: "Portal Gazeta.pl -> http://www.gazeta.pl" Lines: 29 Message-ID: <gau9lh$8r6$1@inews.gazeta.pl> NNTP-Posting-Host: cuk2.internetdsl.tpnet.pl Mime-Version: 1.0 X-Trace: inews.gazeta.pl 1221765618 9062 83.19.66.2 (18 Sep 2008 19:20:18 GMT) X-Complaints-To: usenet@agora.pl NNTP-Posting-Date: Thu, 18 Sep 2008 19:20:18 +0000 (UTC) X-User: abukox User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit