🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: walidacja modelu w przypadku has_and_belongs_to_many

#917
From: Jaroslaw Zabiello
Date: Tue, 05 Feb 2008 04:13
28 lines
2310 bytes
On Wed, 30 Jan 2008 07:32:49 -0000, Paweł Kondzior <kondzior.p@gmail.com>  
wrote:

>>  Uważam, że do przesada. Nie zawsze prawdziwy model "po drodze" jest
>> potrzebny.
>
> Ja sie pod tym podpisuje, The Rails Way is not the only one Way, czasami  
> chodzi tylko o skojarzenie dwoch modeli tabela laczacal i niczym wiecej.

Niestety, ale nie macie racji. To nie tylko osobiste zdanie autora książki  
The Rails Way. To jest oficjalne stanowisko wyrażone w dokumentacji do RoR  
(http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html).  
Makro habtm jest oznaczone oficjalnie jako *DEPRECIATED* i dokumentacja  
RoR SILNIE ZALECA używanie prawdziwych tabel łączących a nie tego  
sztucznego tworu bez modelu, klucza głównego i bez możliwości  
wykorzystania dodatkowym kolumn w tabeli. Cytat:

"Deprecated: Any additional fields added to the join table will be placed  
as attributes when pulling records out through has_and_belongs_to_many  
associations. Records returned from join tables with additional attributes  
will be marked as ReadOnly (because we can‘t save changes to the  
additional attributes). It‘s strongly recommended that you upgrade any  
associations with attributes to a real join model (see introduction)."

-- 
Jarosław Zabiełło
http://blog.zabiello.com
irc://irc.eu.freenode.net/ruby.pl
Technical Details
Message-ID: <op.t5090oxor2rg33@jzmbp.local>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
References: <d3eadb5f-68bc-448f-a7c4-4ef395c49552@i29g2000prf.googlegroups.com> <op.t5o0ezulr2rg33@macbook-pro-zbiru.local> <1978646.8dMPzUgjSc@zatoichi.homeunix.org> <fnp9ik$ojh$1@nemesis.news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
From: "Jaroslaw Zabiello" <abuse@tpnet.pl>
Newsgroups: pl.comp.lang.ruby
Subject: Re: walidacja modelu w przypadku has_and_belongs_to_many
Date: Tue, 05 Feb 2008 04:13:26 -0000
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 28
Message-ID: <op.t5090oxor2rg33@jzmbp.local>
References: <d3eadb5f-68bc-448f-a7c4-4ef395c49552@i29g2000prf.googlegroups.com> <op.t5o0ezulr2rg33@macbook-pro-zbiru.local> <1978646.8dMPzUgjSc@zatoichi.homeunix.org> <fnp9ik$ojh$1@nemesis.news.tpi.pl>
NNTP-Posting-Host: 89.124.240.95
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1202184807 17444 89.124.240.95 (5 Feb 2008 04:13:27 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Tue, 5 Feb 2008 04:13:27 +0000 (UTC)
X-User: hipertracker
User-Agent: Opera Mail/9.25 (MacIntel)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit