Please sign in to comment.
Fixing dynamic finders on associations to properly send arguments to …
…the find_by_* method. Closes issue #330. Commit fdfc8e3 introduced a bugfix to prevent additional values passed to a dynamic find_or_create_by_x methods from confusing the finder. This patch also broke the essential behavior of this method on an association by incorrectly sending arguments to the find_by_x methods. The finder method would always see its inputs as a single array of values instead of individual arguments, almost guaranteeing that the finder call would be incorrect, and that we'd always create a new record instead. This patch adds a splat operator to the parameter array we send along to the dynamic finder so that it receives its inputs correctly, and includes an additional test to ensure that repeated calls to find_or_create_by_x only creates one new record.
- Loading branch information...
Showing with 10 additions and 1 deletion.