Permalink
Browse files

Add support for a create block on find_or_create

  • Loading branch information...
1 parent f1bd9f1 commit 3ec32dc612b9fb08f9261a712022ee63a582a177 @zaius zaius committed with Jun 3, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/sequel/model/base.rb
View
@@ -175,8 +175,8 @@ def find(*args, &block)
# Like find but invokes create with given conditions when record does not
# exist.
- def find_or_create(cond)
- find(cond) || create(cond)
+ def find_or_create(cond, &block)
+ find(cond) || create(cond, &block)
end
# If possible, set the dataset for the model subclass as soon as it

0 comments on commit 3ec32dc

Please sign in to comment.