Re: [DataMapper] can't update json property

2014-03-20 Thread Roman Dzvinkovsky
Charles,

I've faced similar problem recently. AFAIR the reason is that DataMapper
does not recognize the change of hash under Json property. After several
attempts I came up with workaround:

o.data[:key1][:key2] += 1
# o.save # doesn't work
data = o.data
o.data = nil
o.save
o.data = data
o.save



2013-07-26 3:05 GMT+07:00 Charles Monteiro :

> hi,
>
> I have a model property of type Json, said property is set to a hash of a
> hash, apparently updates the to the inner hash are not being picked up by
> DM. In a related question if I wanted to persist a hash, I guess type
> Object would be the default? are there any limits to the the level of
> nesting of an object ?
>
> thanks
>
> -Charles
>
> --
> You received this message because you are subscribed to the Google Groups
> "DataMapper" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to datamapper+unsubscr...@googlegroups.com.
> To post to this group, send email to datamapper@googlegroups.com.
> Visit this group at http://groups.google.com/group/datamapper.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to datamapper+unsubscr...@googlegroups.com.
To post to this group, send email to datamapper@googlegroups.com.
Visit this group at http://groups.google.com/group/datamapper.
For more options, visit https://groups.google.com/d/optout.


Re: [DataMapper] many-to-many in legacy db

2012-09-30 Thread Roman Dzvinkovsky
Thanks you!

2012/9/24 Zhi-Qiang Lei :
> En taro Tassadar,
>
> You can write it in this way.
>
> class ContactFund
>   include DataMapper::Resource
>
>   def self.default_repository_name
> :vm_legacy
>   end
>
>   storage_names[:vm_legacy] = 'contactfunds'
>
>   belongs_to :fund
>   belongs_to :contact
>
>   property :fund_id, String, key: true, field: "fundID"
>   property :contact_id, String, key: true, field: "contactID"
> end
>
>
> On Sep 24, 2012, at 8:17 AM, romand wrote:
>
> En taro Tassadar,
>
> I use DM to access legacy db with many-to-many relationship between Fund and
> Contact models, through ContactFund -- table with 2 columns: 'fundID' and
> 'contactID'.
> Here is my model: http://pastebin.com/KtQcdRyq
> But child_key is ignored for some reason, so DM looks for 'fund_id' instead
> of 'fundID': http://pastebin.com/yBCT9NNg
>
> How do I write ContactFund correctly?
>
> Thanks in advance,
> Roman.
>
> --
> You received this message because you are subscribed to the Google Groups
> "DataMapper" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/datamapper/-/l9OB8C38670J.
> To post to this group, send email to datamapper@googlegroups.com.
> To unsubscribe from this group, send email to
> datamapper+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/datamapper?hl=en.
>
>
>
> Best regards,
> Zhi-Qiang Lei
> zhiqiang@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "DataMapper" group.
> To post to this group, send email to datamapper@googlegroups.com.
> To unsubscribe from this group, send email to
> datamapper+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/datamapper?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamapper@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.