Ripple strange behavior/bug?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Ripple strange behavior/bug?

John Axel Eriksson
I've been rewriting a small app of ours to run on Riak instead of MongoDB and
I've run into a bug or weird behavior. To show this off I created a very simple little
Rails 3 app where this happens. It can be found here:

<a href="git://github.com/johnae/Riak-Rails-Ripple-Test-to-show-some-weird-behavior.git">git://github.com/johnae/Riak-Rails-Ripple-Test-to-show-some-weird-behavior.git


Perhaps I'm doing something wrong but the app has two models, Client and Address.

A Client has one Address and an Address has one Client. I've created a form to just add
addresses at /addresses/new and one for clients at /clients/new. There is only a single text
field in /addresses/new - just add a few of them. Then go to /clients/new where you can enter
a name for the client and select an address in a select box. Hit Save, then you get something like this:

Invalid value "R2HQfdNWBz4TtxbYgZBLKIriTwl" for association address of type Address on <Client:Blahaha created_at=2010-09-07 16:17:02 +0200 updated_at=nil name="Blahaha">

This is the same type  of error I get in the larger app I'm working on and I can't figure out whats
wrong (me or Ripple I guess)...


John

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Ripple strange behavior/bug?

Sean Cribbs-2
John,

It sounds like you're assigning the key of the Address to the association on the Client.  If these are in a one-to-one relationship, it would make more sense to me to store the Address inside the Client object.  On the other hand, if you prefer them to be linked, load the Address in your controller before assigning it to the association.

I've also added an issue for *_keys accessor methods that should ease the linking up of independent objects. These would be similar to the *_ids methods that ActiveRecord provides. http://github.com/seancribbs/ripple/issues/#issue/57

Sean Cribbs <[hidden email]>
Developer Advocate
Basho Technologies, Inc.

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Ripple strange behavior/bug?

John Axel Eriksson
Yeah, well it looks like that. I haven't had any problems with associating an address to a client
through rails console for example but then I would do:

client = Client.new(:name => 'someclient')
client.address = Address.new(:address => 'abcde' )
client.save

The problem is in the form building, and I don't know if there perhaps isn't support for that or if
it's a bug or if I'm doing something wrong.

J

7 sep 2010 kl. 16.44 skrev Sean Cribbs:

John,

It sounds like you're assigning the key of the Address to the association on the Client.  If these are in a one-to-one relationship, it would make more sense to me to store the Address inside the Client object.  On the other hand, if you prefer them to be linked, load the Address in your controller before assigning it to the association.

I've also added an issue for *_keys accessor methods that should ease the linking up of independent objects. These would be similar to the *_ids methods that ActiveRecord provides. http://github.com/seancribbs/ripple/issues/#issue/57

Sean Cribbs <[hidden email]>
Developer Advocate
Basho Technologies, Inc.


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