Re use cases, we a comparable thing in one of my projects (:only would
also be my vote for the option name):
module Enumerable
# Like #first and #last, but raises an error if there's more than one item in
# the collection. Useful to make code that only makes sense if there's only
# one of
This just feels a little backwards. Enforcement of how many records are in
the db is not the responsibility of the finder. Uniqueness should be
enforced in the database and in the parts of the application that insert and
update data.
I concede it would be useful to have a more-flexible form of
A
Yeah I agree with Paul that :unique is a bit misleading. Also, I'm not
sure if I've had a case using .first() where it'd matter if there were
more than one matching row. Could you mention your actual use cases ?
Thanks.
On Thu, Jul 30, 2009 at 6:22 PM, Joris wrote:
>
> Hi guys,
>
> Pratik pointe
I'd have to say I think :one would be a better choice, or :single. I agree
with the request though. :unique brings to mind SELECT DISTINCT and is
misleading in my opinion.
Paul Bowsher
On Thu, Jul 30, 2009 at 6:22 PM, Joris wrote:
>
> Hi guys,
>
> Pratik pointed me here. I have submitted featur
On Thu, Jul 30, 2009 at 4:02 PM, Rob Biedenharn wrote:
> If you hadn't limited your reading to the code example:
Ah .. My bad. Then I can make sense of it.
fwiw I welcome this change. It'll cause some pain to get introduced,
but it's the right thing and in the end everybody will be better off
th
Hi guys,
Pratik pointed me here. I have submitted feature request #2974.
It's basically a new finder: unique. To be used at times where people
use :first.
Often, you query for something, and expect only a single record.
To do this, people use :first. However, :first does not check for any
follo
I posted this on the talk list and didn't get a response. Perhaps
this is a more appropriate list:
I'm having a problem with rails 2.3.2, engines, and eager loading.
There is a default set of eager_load_paths (the usual suspects under
app/) that will be greedily required by rails at boot time wh
On Jul 30, 2009, at 4:19 AM, troels knak-nielsen wrote:
>
> Hi list.
>
> On Thu, Jul 30, 2009 at 12:20 AM, Michael
> Koziarski wrote:
>>
>> # safe_helper :some_helper after declaring the helper
>> # <%= raw(some_helper) %>
>>
>
> Is it necessary to have both a `safe_helper` declaration and an
>
Hi list.
On Thu, Jul 30, 2009 at 12:20 AM, Michael
Koziarski wrote:
>
> # safe_helper :some_helper after declaring the helper
> # <%= raw(some_helper) %>
>
Is it necessary to have both a `safe_helper` declaration and an
explicit call to `raw`? Wouldn't one or the other be sufficient?
--
troels