On Feb 8, 2008 2:00 PM, Glenn Rempe <[EMAIL PROTECTED]> wrote: > > Hello, I posted this on the rails talk group but received no > response. Perhaps someone on this list could weigh in on whether this > is expected/desired behavior or a bug that I should file and develop > failing tests for > (I doubt I have the active record method_missing fu to actually patch > it). > > Test Scenario: > I would like to find or initialize a new user and base the find on the > users email address, however the user found has to also match one of > two possible 'state' values (passive || pending_singup). While trying > to implement this I discovered that the find_or_(initialize| > create)_by_* dynamic finders totally and silently ignore any > conditions passed. > > Bug?
Not really. Because the second argument to those dynamic initializers is an attributes hash to be added to the newly created object, not arguments for find. So it's treating them as if you want to call @user.conditions= {:state => 'passive'} if it doesn't find a user with that email address. -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---