🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: walidacja modelu w przypadku has_and_belongs_to_many

#913
From: Jaroslaw Zabiello
Date: Tue, 29 Jan 2008 13:14
16 lines
1323 bytes
On Sun, 27 Jan 2008 23:18:31 -0000, RaW <rafal@wrzochol.net> wrote:

> class Role < ActiveRecord::Base
>   has_and_belongs_to_many :rights
> end
>
> W jaki sposób mogę wykonać 'validates_presence_of' dla 'role.rights'?

Nie używaj HABTM, jest niezalecane. Lepiej używać has_many w połączeniu z  
:through. The Rails Way uważa, że tak jest lepiej, masz wtedy prawdziwy  
model i więcej możliwości.

-- 
Jarosław Zabiełło
http://blog.zabiello.com
irc://irc.eu.freenode.net/ruby.pl
Technical Details
Message-ID: <op.t5o0ezulr2rg33@macbook-pro-zbiru.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>

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, 29 Jan 2008 13:14:49 -0000
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 16
Message-ID: <op.t5o0ezulr2rg33@macbook-pro-zbiru.local>
References: <d3eadb5f-68bc-448f-a7c4-4ef395c49552@i29g2000prf.googlegroups.com>
NNTP-Posting-Host: 62.77.187.21
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1201612491 14519 62.77.187.21 (29 Jan 2008 13:14:51 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Tue, 29 Jan 2008 13:14:51 +0000 (UTC)
X-User: hipertracker
User-Agent: Opera Mail/9.25 (MacIntel)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit