Sha256: c2ea52b44d6665afc35065d5b61a2d35ab709f38c1c58b1b544766d58956735a
Contents?: true
Size: 603 Bytes
Versions: 2
Compression:
Stored size: 603 Bytes
Contents
#!/usr/bin/env ruby -rubygems require File.dirname(__FILE__) + '/authentication' # create a entry without fetching the collection klass = StorageRoom.class_for_name('Guidebook') entry1 = klass.new(:name => 'Foo', :price => 1.23) if entry1.save puts "Entry saved" else puts "Entry could not be saved: #{entry1.errors.join(', ')}" end # fetch the collection first collection = StorageRoom::Collection.find('guidebooks') entry2 = collection.entry_class.new(:name => 'Bar', :price => 2.23) if entry2.save puts "Entry saved" else puts "Entry could not be saved: #{entry2.errors.join(', ')}" end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
storage_room-0.1.3 | examples/create_entry.rb |
storage_room-0.1.2 | examples/create_entry.rb |