On Jul 24, 2012, at 5:42 PM, Jon Leighton wrote:
On 24/07/12 21:29, Matt Jones wrote:
Nope, that's not exactly what I observed; I'll try again. That code *does*
call the create correctly, if there are no users with the correct
first_name. The confusing part to me was that it wasn't
I just ran across a weird glitch (IMHO) in find_or_create. The arguments passed
to it are *not* added to the conditions for the 'first' part. This is odd,
given that it's intended to replace find_or_create_by_* methods, which *did*
use the specified values as conditions.
I'm unsure on whether
I would definitely expect
User.where(:first_name = 'Scarlett').first_or_create(:last_name =
O'Hara)
to call
User.create(:first_name = 'Scarlett', :last_name = O'Hara)
if that's not what's happening then I think it's a bug and should be fixed.
Matt, do you have a minimal app that shows the
On Jul 24, 2012, at 4:04 PM, Andrés Mejía wrote:
I would definitely expect
User.where(:first_name = 'Scarlett').first_or_create(:last_name = O'Hara)
to call
User.create(:first_name = 'Scarlett', :last_name = O'Hara)
if that's not what's happening then I think it's a bug and should
On 24/07/12 21:29, Matt Jones wrote:
On Jul 24, 2012, at 4:04 PM, Andrés Mejía wrote:
I would definitely expect
User.where(:first_name = 'Scarlett').first_or_create(:last_name = O'Hara)
to call
User.create(:first_name = 'Scarlett', :last_name = O'Hara)
if that's not what's happening then