Sha256: be0868a88511a843ed285f11ae28daed7e3c0dc4523a2e33176814ab78c3e3be

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 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(:title => '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(:title => 'Bar', :price => 2.23)

if entry2.save
  puts "Entry saved"
else
  puts "Entry could not be saved: #{entry2.errors.join(', ')}"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
storage_room-0.1.4 examples/create_entry.rb