[Rails-core] Re: Opinion about new finder: :unique

2009-07-30 Thread Will Bryant
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

[Rails-core] Re: Opinion about new finder: :unique

2009-07-30 Thread Duncan Beevers
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

[Rails-core] Re: Opinion about new finder: :unique

2009-07-30 Thread Pratik
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

[Rails-core] Re: Opinion about new finder: :unique

2009-07-30 Thread Paul Bowsher
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

[Rails-core] Re: On-By-Default XSS escaping

2009-07-30 Thread troels knak-nielsen
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

[Rails-core] Opinion about new finder: :unique

2009-07-30 Thread Joris
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

[Rails-core] threadsafe! & engines

2009-07-30 Thread Tyler Jennings
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

[Rails-core] Re: On-By-Default XSS escaping

2009-07-30 Thread Rob Biedenharn
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 >

[Rails-core] Re: On-By-Default XSS escaping

2009-07-30 Thread troels knak-nielsen
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