Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Using a model without a table

Received: by 10.59.1.65 with SMTP id be1mr6168618ved.1.1349912272824;
        Wed, 10 Oct 2012 16:37:52 -0700 (PDT)
X-BeenThere: sequel-talk@googlegroups.com
Received: by 10.220.147.138 with SMTP id l10ls903401vcv.7.gmail; Wed, 10 Oct
 2012 16:37:51 -0700 (PDT)
Received: by 10.58.15.10 with SMTP id t10mr1089080vec.6.1349912271741;
        Wed, 10 Oct 2012 16:37:51 -0700 (PDT)
Received: by 10.58.15.10 with SMTP id t10mr1089079vec.6.1349912271725;
        Wed, 10 Oct 2012 16:37:51 -0700 (PDT)
Return-Path: <joe.escala...@gmail.com>
Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54])
        by gmr-mx.google.com with ESMTPS id ef10si208943vdb.3.2012.10.10.16.37.51
        (version=TLSv1/SSLv3 cipher=OTHER);
        Wed, 10 Oct 2012 16:37:51 -0700 (PDT)
Received-SPF: pass (google.com: domain of joe.escala...@gmail.com designates 209.85.212.54 as permitted sender) client-ip=209.85.212.54;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of joe.escala...@gmail.com designates 209.85.212.54 as permitted sender) smtp.mail=joe.escala...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-vb0-f54.google.com with SMTP id v11so1396596vbm.13
        for <sequel-talk@googlegroups.com>; Wed, 10 Oct 2012 16:37:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :content-type;
        bh=kIu7cgeV+8YbNSK8fUWLeq8r/jEGnpM0J80P3urD8/0=;
        b=Eo6uUlyKJZADOrbFJlOoFAuv9u4JiCWkA5Qyl4HRefJv0SX70i/V3CxK3WoO1y9vhU
         bbFs7ZJdZMWcsIrD74Siby6ddZ+m07YflDhmW47xtNOc8eeEAODyNu9B9yLCvqT8KTcn
         VLvTc6e1Nj+4QRTV4tzkmALadx4PpmAgwMqjKL1EaEFNQ6M5k8jzfuyR9nw8JBqzzdu2
         Z2glh1IT34YBMOTI4aIikPS12IZL+Lwzdp+Y+H5g9cQ1VzXYSKeLPXe0/PkfBAdEiAOW
         8hHaOwLQxfGU/zMGfxUELxL1DCXWWlVJdmeXn/wRkTIbpu9bZgh6TfWE9bAf7IEK95jp
         TiLw==
Received: by 10.52.71.44 with SMTP id r12mr12146784vdu.41.1349912271544; Wed,
 10 Oct 2012 16:37:51 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.220.147.198 with HTTP; Wed, 10 Oct 2012 16:37:31 -0700 (PDT)
In-Reply-To: <b86a1145-c65f-4ad5-8480-6e08f4b22111@googlegroups.com>
References: <4d9ca19e-434c-4959-a309-8dfda2a7a...@e18g2000yqo.googlegroups.com>
 <06b92906-1ad2-4a0e-b4f2-8c6783c77daa@googlegroups.com> <CA+1UwOkjzMVmvFBnBFBD01YHa1AasencsjjrN-sbPpFcBVh...@mail.gmail.com>
 <b86a1145-c65f-4ad5-8480-6e08f4b22111@googlegroups.com>
From: JoeLoui <joe.escala...@gmail.com>
Date: Wed, 10 Oct 2012 20:37:31 -0300
Message-ID: <CA+1UwOkyNKFiY3vSiAeUAMrmCr7PYgMVR-RJ5JmpeqLYmB-...@mail.gmail.com>
Subject: Re: Using a model without a table
To: sequel-talk@googlegroups.com
Content-Type: multipart/alternative; boundary=20cf307f32b66c602a04cbbcf12e

--20cf307f32b66c602a04cbbcf12e
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Oct 10, 2012 at 6:24 PM, Jeremy Evans <jeremyeva...@gmail.com>wrote:

> On Wednesday, October 10, 2012 10:58:02 PM UTC+2, JoeLoui wrote:
>>
>> Sorry for not being more specific, I tried to be general but I realized
>> that is difficulting the problem understading. Here it is the gist<https://gist.github.com/3868059>with the full backtraces for both examples.
>>
>> In my Foo class I'm using something like this<https://gist.github.com/3868152>.
>> The reason I'm doing this it's because I don't want to repeat this code in
>> Bar1 and Bar2, and it's worth to mention that Bar1 and Bar2 each has
>> differents columns but shares the relationship with user (and the
>> callbacks). I supossed that I could use a sequel model as a some kind of
>> interface in order to DRYup the code, besides I will never need instantiate
>> Foo for any reason, but it would be handy sometimes not to care having a
>> Foo object whether is Bar1 or Bar2. As you correctly guessed I think I'm
>> using methods which needs a dataset, in what other ways can I make this?
>>
>
> You can use a plain ruby module with an included/extended hook or plugin
> to share code between models in this way.  See
> https://gist.github.com/3868477 for an example using a plugin.
>
> Jeremy
>
>
>
That's a great idea! In the beginning I thought about using a module too,
but I discarded the idea because I thought that Sequel could have something
like an interface, but now I realize that this is Ruby and not Java and the
modules are powerful and flexible!

Thank you!
Joe

--20cf307f32b66c602a04cbbcf12e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br><div class=3D"gmail_quote">On Wed, Oct 10, 2012 at 6:24 PM, Jeremy =
Evans <span dir=3D"ltr">&lt;<a href=3D"mailto:jeremyeva...@gmail.com" targe=
t=3D"_blank">jeremyeva...@gmail.com</a>&gt;</span> wrote:<br><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;p=
adding-left:1ex">

<div class=3D"im">On Wednesday, October 10, 2012 10:58:02 PM UTC+2, JoeLoui=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div class=3D"gmail_quote"><=
div>

Sorry for not being more specific, I tried to be general but I realized=20
that is difficulting the problem understading. Here it is the <a href=3D"ht=
tps://gist.github.com/3868059" target=3D"_blank">gist</a> with the full bac=
ktraces for both examples.<br>


<br>In my Foo class I&#39;m using something like <a href=3D"https://gist.gi=
thub.com/3868152" target=3D"_blank">this</a>.
 The reason I&#39;m doing this it&#39;s because I don&#39;t want to repeat =
this code
 in Bar1 and Bar2, and it&#39;s worth to mention that Bar1 and Bar2 each ha=
s
 differents columns but shares the relationship with user (and the=20
callbacks). I supossed that I could use a sequel model as a some kind of=20
interface in order to DRYup the code, besides I will never need=20
instantiate Foo for any reason, but it would be handy sometimes not to=20
care having a Foo object whether is Bar1 or Bar2. As you correctly guessed =
I think I&#39;m using methods which needs a dataset, in what other ways can=
 I make this?<br></div></div></blockquote><div><br></div></div><div>You can=
 use a plain ruby module with an included/extended hook or plugin to share =
code between models in this way. =A0See=A0<a href=3D"https://gist.github.co=
m/3868477" target=3D"_blank">https://gist.github.com/3868477</a> for an exa=
mple using a plugin.</div>

<div class=3D"im"><div><br></div><div>Jeremy=A0</div>

<p></p><br></div></blockquote><div><br>That&#39;s a great idea! In the begi=
nning I thought about using a module too, but I discarded the idea because =
I thought that Sequel could have something like an interface, but now I rea=
lize that this is Ruby and not Java and the modules are powerful and flexib=
le!<br>

<br>Thank you!<br>Joe<br></div></div>

--20cf307f32b66c602a04cbbcf12e--