🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: RoR vs PHP

#829
From: Jaroslaw Zabiello
Date: Wed, 02 Jan 2008 09:59
35 lines
2263 bytes
On Wed, 02 Jan 2008 08:33:31 -0000, Maciej Piechotka  
<uzytkownik2@gmail.com> wrote:

>> class Child1 < Sequel::Model(:childs1)
>>    set_schema do
>>      primary_key :parent_id
>>      varchar :pole1
>>    end
>>    before_save do
>>      unless Parent[Child1.max(:parent_id).to_i + 1]
>>        raise 'Parent cannot assign more childs1 objects'
>>      end
>>    end
>> end
>
> Ale Child1 nie jest pochodną klasy Parent.

Proszę bardzo. Oto wersja w której jest pochodną klasy Parent:

class Child1 < Parent
   set_dataset DB[:childs1]
   set_schema do
     primary_key :parent_id
     varchar :pole1
   end
   before_save do
     unless Parent[Child1.max(:parent_id).to_i + 1]
       raise 'Parent cannot assign more childs1 objects'
     end
   end
end

-- 
Jarosław Zabiełło
http://blog.zabiello.com
Technical Details
Message-ID: <op.t4ardgyxr2rg33@jzmbp.westglobal.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
References: <fl6ahk$m1q$1@inews.gazeta.pl> <op.t351icnsr2rg33@jzmbp.local> <fl93bh$d8p$1@inews.gazeta.pl> <r4il45-1ar.ln1@router.piechotka.com.pl> <op.t358bkfwr2rg33@jzmbp.local> <fl9aau$9b9$5@inews.gazeta.pl> <20071231084648.6d47feda.gryf_esm-no@spam-o2.pl> <op.t37dq3ydr2rg33@jzmbp.local> <0enn45-u25.ln1@router.piechotka.com.pl> <op.t37qnpdrr2rg33@jzmbp.local> <3pbo45-ha7.ln1@router.piechotka.com.pl> <op.t3777x1jr2rg33@jzmbp.local> <jtip45-n8c.ln1@router.piechotka.com.pl> <op.t388lvhur2rg33@jzmbp.local> <h96q45-37f.ln1@router.piechotka.com.pl> <op.t39jhmarr2rg33@jzmbp.local> <grhq45-5dg.ln1@router.piechotka.com.pl> <op.t39xi4kdr2rg33@jzmbp.local> <op.t4aafpggr2rg33@jzmbp.local> <rrur45-29m.ln1@router.piechotka.com.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: RoR vs PHP
Date: Wed, 02 Jan 2008 09:59:30 -0000
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 35
Message-ID: <op.t4ardgyxr2rg33@jzmbp.westglobal.com>
References: <fl6ahk$m1q$1@inews.gazeta.pl> <op.t351icnsr2rg33@jzmbp.local> <fl93bh$d8p$1@inews.gazeta.pl> <r4il45-1ar.ln1@router.piechotka.com.pl> <op.t358bkfwr2rg33@jzmbp.local> <fl9aau$9b9$5@inews.gazeta.pl> <20071231084648.6d47feda.gryf_esm-no@spam-o2.pl> <op.t37dq3ydr2rg33@jzmbp.local> <0enn45-u25.ln1@router.piechotka.com.pl> <op.t37qnpdrr2rg33@jzmbp.local> <3pbo45-ha7.ln1@router.piechotka.com.pl> <op.t3777x1jr2rg33@jzmbp.local> <jtip45-n8c.ln1@router.piechotka.com.pl> <op.t388lvhur2rg33@jzmbp.local> <h96q45-37f.ln1@router.piechotka.com.pl> <op.t39jhmarr2rg33@jzmbp.local> <grhq45-5dg.ln1@router.piechotka.com.pl> <op.t39xi4kdr2rg33@jzmbp.local> <op.t4aafpggr2rg33@jzmbp.local> <rrur45-29m.ln1@router.piechotka.com.pl>
NNTP-Posting-Host: 62.77.187.21
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1199267972 19449 62.77.187.21 (2 Jan 2008 09:59:32 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Wed, 2 Jan 2008 09:59:32 +0000 (UTC)
X-User: hipertracker
User-Agent: Opera Mail/9.25 (MacIntel)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit