public
Rubygem
Description: DataMapper - Core
Homepage: http://datamapper.org
Clone URL: git://github.com/sam/dm-core.git
Search Repo:
Removing find_or_create because it's in dm-ar-finders (jumped the gun on 
that one)
myobie (author)
Thu May 08 12:41:17 -0700 2008
commit  2b7e93887d8e48a9602dd49ab881e07e2ef4cb53
tree    ffe01e698e752444b34bd7f51d08b04845ef96c4
parent  3154ecd2d2bf54e77f491f65a5af68798839f276
...
387
388
389
390
391
392
393
394
395
396
...
387
388
389
 
 
 
 
390
391
392
0
@@ -387,10 +387,6 @@
0
         resource
0
       end
0
 
0
- def find_or_create(search_attributes, create_attributes = {})
0
- first(search_attributes) || create(search_attributes.merge(create_attributes))
0
- end
0
-
0
       # TODO SPEC
0
       def copy(source, destination, options = {})
0
         repository(destination) do
...
286
287
288
289
290
291
292
293
294
295
296
297
298
...
286
287
288
 
 
 
 
 
 
 
289
290
291
0
@@ -286,13 +286,6 @@
0
       Planet.should respond_to(:first)
0
       Planet.should respond_to(:all)
0
       Planet.should respond_to(:[])
0
- Planet.should respond_to(:find_or_create)
0
- end
0
-
0
- it 'should create if it cannot find (using find_or_create)' do
0
- Planet.should_receive(:first).with({ :age => 1 }).and_return(nil)
0
- Planet.should_receive(:create).with({ :age => 1, :name => "Fuzzy" }).and_return(true)
0
- Planet.find_or_create({:age => 1}, { :name => "Fuzzy" })
0
     end
0
     
0
     it '.exists? should return whether or not the repository exists' do

Comments

  • dkubb Thu May 08 15:51:43 -0700 2008

    Ahh, just saw this. Please ignore my earlier comment.
    I do think if every a find & create method was ever put into dm-core, it would likely follow DM’s naming conventions.. so like get_or_create or first_or_create, or something similar.