Sha256: 9216a7f480de89b20c0aa8893242c369db63c97f2bde358ea8203dc5ed3685d6
Contents?: true
Size: 676 Bytes
Versions: 4
Compression:
Stored size: 676 Bytes
Contents
$: << "~/Projects/Medea/lib" require 'medea' class Message < Medea::JasonObject end class User < Medea::JasonObject owns_many :messages, Message end puts "Enter an id, or blank to make a new user:" id = gets.strip if id == "" u = User.new puts "User's name?" u.name = gets.strip puts "Saving" u.save! else u = User.get_by_key id puts "#{u.name} has posted #{u.messages.count} messages" end while true puts "Enter a message (blank to stop):" message = gets.strip break if message == "" m = Message.new m.message = message m.from = u.name u.messages.add! m end puts "Fetching messages..." u.messages.each do |e| puts " - #{e.message}\n" end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
medea-0.2.29 | lib/testmeta.rb |
medea-0.2.28 | lib/testmeta.rb |
Medea-0.2.27 | lib/testmeta.rb |
Medea-0.2.26 | lib/testmeta.rb |