Hi all,
I'm having trouble setting up a one association in a ripple document. I'm
trying to setup an association between a user and a journal entry, such that
the journal has one user, that the user created.
My JournalEntry document:
--- journal_entry.rb ---
require 'ripple'
class JournalEntry
include Ripple::Document
property :short_title, String, :presence => true
property :title, String, :presence => true
property :entry, String, :presence => true
timestamps!
one :user
key_on :short_title
end
---
My User document:
--- user.rb ---
require 'ripple'
require 'digest'
class User
include Ripple::Document
devise :registerable, :confirmable, :database_authenticatable, :recoverable,
:validatable
property :email, String, :presence => true
property :password, String
property :password_confirmation, String
timestamps!
key_on :email
def key
email
end
def id
email
end
end
---
I've tried in the rails console to associate a user with journal_entry
(journal_entry.user = user), save it and reload it. The resulting reloaded
journal_entry does not have a user (calling journal_entry.user prints "(Object
doesn't support #inspect)").
My journal entry in riak loaded via the browser looks like:
{"short_title":"test","title":"test","entry":"test","created_at":"Mon, 07 Feb
2011 22:47:17 -0000","updated_at":"Tue, 08 Feb 2011 18:08:47
-0000","_type":"JournalEntry"}
Does anyone know what I'm doing wrong?
Cheers!
Steve
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com