Message from discussion
find_by_sql - ActiveRecord - Help please.
Received: by 10.42.65.138 with SMTP id l10mr4235467ici.26.1352362155511;
Thu, 08 Nov 2012 00:09:15 -0800 (PST)
X-BeenThere: rubyonrails-talk@googlegroups.com
Received: by 10.42.244.193 with SMTP id lr1ls5788703icb.1.gmail; Thu, 08 Nov
2012 00:08:47 -0800 (PST)
Received: by 10.50.41.132 with SMTP id f4mr9584773igl.1.1352362127107;
Thu, 08 Nov 2012 00:08:47 -0800 (PST)
Received: by 10.50.41.132 with SMTP id f4mr9584772igl.1.1352362127095;
Thu, 08 Nov 2012 00:08:47 -0800 (PST)
Return-Path: <clan...@googlemail.com>
Received: from mail-ob0-f173.google.com (mail-ob0-f173.google.com [209.85.214.173])
by gmr-mx.google.com with ESMTPS id uk11si594545igb.2.2012.11.08.00.08.47
(version=TLSv1/SSLv3 cipher=OTHER);
Thu, 08 Nov 2012 00:08:47 -0800 (PST)
Received-SPF: pass (google.com: domain of clan...@googlemail.com designates 209.85.214.173 as permitted sender) client-ip=209.85.214.173;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of clan...@googlemail.com designates 209.85.214.173 as permitted sender) smtp.mail=clan...@googlemail.com; dkim=pass header...@gmail.com
Received: by mail-ob0-f173.google.com with SMTP id wc18so2976249obb.32
for <rubyonrails-talk@googlegroups.com>; Thu, 08 Nov 2012 00:08:46 -0800 (PST)
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=b6A7/NH6+V7OuTrt6N6/D9PiVxXyeFgBB58D8u9nKoo=;
b=okQDmyKbQIo228lVGRamncdBhETqzdEoQabZbbFb6TTDJwfLq2GTJ9Ve+n+FstGBWk
OdUhJkfpeqfW1vqabae4Ipw+0otSBNVRj6ufl8ZC60MNEzXVaawDjQp0SR/uZtlUMlMD
WZerFLOZdhZSU3A+Zx9G1kuODczPYBoRAIA+mkAEPAYOvmXZFzB772MwAo6KnzAq8NG8
NUmqyuwBIuvdewrlVfudRGmjvA9NNDr0A8HpUx0eIWgT857oJzm8PY38fNir2aEYluh7
+U0pQbWCiYd9Wu6DhLQi9aLk5fm5TJWAyceP1eFuj22PzcRBITsB4SiLQkuXeghZ+07l
USgw==
Received: by 10.182.39.9 with SMTP id l9mr5011677obk.32.1352362126820; Thu, 08
Nov 2012 00:08:46 -0800 (PST)
MIME-Version: 1.0
Received: by 10.182.139.3 with HTTP; Thu, 8 Nov 2012 00:08:16 -0800 (PST)
In-Reply-To: <7e7d237f59a610b70838730b92940...@ruby-forum.com>
References: <84fd1d9c64af28e3bdd62368b516c...@ruby-forum.com>
<CAL=0gLuqBgxY8YrnPdmHkdpiSHMO2gE9kyn9jZpLbUKUWcu...@mail.gmail.com>
<3c3fb3d3222180359b7e8addb6a6d...@ruby-forum.com> <CAL=0gLvFC+0bW5aP+yz9VeMo-k4LRLyOR3VcmqLayYWsWtz...@mail.gmail.com>
<7e7d237f59a610b70838730b92940...@ruby-forum.com>
From: Colin Law <clan...@googlemail.com>
Date: Thu, 8 Nov 2012 08:08:16 +0000
Message-ID: <CAL=0gLs4qMKUDGEdr4jwnsZaZyExzWYjfQneKe0y2nK0x1H...@mail.gmail.com>
Subject: Re: [Rails] Re: Re: find_by_sql - ActiveRecord - Help please.
To: rubyonrails-talk@googlegroups.com
Content-Type: text/plain; charset=UTF-8
On 7 November 2012 22:49, Jeff Lockyer <li...@ruby-forum.com> wrote:
> Hi Colin,
>
> I don't think it is, in fact I know it isn't empty because the logic is
> inside a test for the return size of 0.
>
> if @my_names.size == 0
>
> render :update do |page|
> // Bunch of updating code to the displayed message to
> indicate no match found.
> page[:name].visualEffect('highlight')
> end
This end would appear to close the if statement.
>
> else
I am surprised that does not cause a syntax error.
Also as others have pointed out the first element of the array could be nil.
Colin