Sean,

$ puts journal_entry.robject.links.inspect
#<Set: {</riak/users/stephenallred%40stevesmiscellany.com>; riaktag="user", 
</riak/journal_entries>; riaktag="up"}>
 => nil 

$ journal_entry
 => <JournalEntry:test short_title="test" title="test" entry="test" 
created_at=2011-02-07 22:47:17 UTC updated_at=2011-02-08 18:08:47 UTC>

$ journal_entry.user
(Object doesn't support #inspect)
 =>

$ journal_entry.user.inspect
NoMethodError: undefined method `key' for nil:NilClass
        from 
/Users/stephenallred/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/whiny_nil.rb:48:in
 `method_missing'
        from 
/Users/stephenallred/.rvm/gems/ruby-1.9.2-p0/gems/ripple-0.8.3/lib/ripple/document/finders.rb:122:in
 `block in instantiate'
        from 
/Users/stephenallred/.rvm/gems/ruby-1.9.2-p0/gems/ripple-0.8.3/lib/ripple/document/finders.rb:121:in
 `tap'
        from 
/Users/stephenallred/.rvm/gems/ruby-1.9.2-p0/gems/ripple-0.8.3/lib/ripple/document/finders.rb:121:in
 `instantiate'
        from 
/Users/stephenallred/.rvm/gems/ruby-1.9.2-p0/gems/ripple-0.8.3/lib/ripple/associations/one_linked_proxy.rb:25:in
 `find_target'
        from 
/Users/stephenallred/.rvm/gems/ruby-1.9.2-p0/gems/ripple-0.8.3/lib/ripple/associations/proxy.rb:113:in
 `load_target'
        from 
/Users/stephenallred/.rvm/gems/ruby-1.9.2-p0/gems/ripple-0.8.3/lib/ripple/associations/proxy.rb:41:in
 `inspect'
        from (irb):17
        from 
/Users/stephenallred/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in
 `start'
        from 
/Users/stephenallred/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in
 `start'
        from 
/Users/stephenallred/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:23:in
 `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

Hopefully those are useful,
Thanks for the quick response!
Steve

On 8 Feb 2011, at 6:37 PM, Sean Cribbs wrote:

> Stephen,
> 
> Sounds like you've either found a bug.  When you have saved the journal entry 
> in irb, what is the output of this command?
> 
> puts journal_entry.robject.links.inspect
> 
> Sean Cribbs <[email protected]>
> Developer Advocate
> Basho Technologies, Inc.
> http://basho.com/
> 
> On Feb 8, 2011, at 1:23 PM, Stephen Allred wrote:
> 
>> 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
> 


_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to