Understood.

So, I think that the EV approach is better for my problem, but your technic
seems to be a good alternative for while.

Thanks Ted and Piort!

2011/4/12 Ted Han <[email protected]>

> No, not quite.
>
> It depends on whether you will be using Address and Person objects
> independently of each other, or whether the Address object is a dependent
> object that will only ever be used in the context of it's Person.  If you're
> going for the latter, then you do want EV (although you can kinda fake it
> with what i wrote above).
>
> If you want proper EV though, you'll have to wait for Piotr's work.
>
> The difference will matter in terms of how objects are fetched and saved in
> particular.  EV provides much clearer semantics for it, and changing the
> address on a person record, and someone's email will only require one update
> to be fired to the database, as opposed to two in the case of what i wrote
> above.
>
> -T
>
> On Tue, Apr 12, 2011 at 10:44 AM, Jean Baldessar <[email protected]
> > wrote:
>
>> I was looking for a solution like the @Embedded from Java Persistence API.
>> So, at first glance the name EmbeddedValue looked like the kind of
>> feature that im looking after.
>> Ted solution seems to work to, but I dont realy understand the diference
>> between the Ted and Piotr solutions.
>>
>> They are not the same thing?
>>
>> 2011/4/12 Ted Han <[email protected]>
>>
>>> Erm, what he's talking about isn't quite EV though is it?  There's not a
>>> record substructure to his table.  This'd be a logical delineation of two
>>> sets of properties, they're still keyed by the same primary value yeah?
>>>
>>>
>>> On Tue, Apr 12, 2011 at 10:30 AM, Piotr Solnica <[email protected]
>>> > wrote:
>>>
>>>> Hi Jean,
>>>>
>>>> What you're looking for is called EmbeddedValue and DataMapper doesn't
>>>> support it yet. It's scheduled for 1.2.0 release and the work has
>>>> already been started. The API will look more or less like that:
>>>> https://gist.github.com/886807#file_dm_ev.rb
>>>>
>>>> Cheers
>>>>
>>>> # solnic
>>>>
>>>> On Apr 12, 4:26 pm, Jean Baldessar <[email protected]> wrote:
>>>> > Hi,
>>>> >
>>>> > Is it possible to break a table in two Ruby objects? Ex:
>>>> >
>>>> > Ruby objects:
>>>> >
>>>> > class Pessoa
>>>> >         property :id,            Serial
>>>> >         property :name,           String
>>>> > end
>>>> > class Address
>>>> >         property :street,           String
>>>> >         property :city,           String
>>>> > end
>>>> >
>>>> > Table:
>>>> >
>>>> > table Person
>>>> > id number
>>>> > name varchar
>>>> > city varchar
>>>> > street varchar
>>>> >
>>>> > How can i make the "connection" between them And is it possible to
>>>> make the
>>>> > inverse? (table Person and Address to a single Ruby object Person)
>>>> >
>>>> > Thks in advance,
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "DataMapper" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> 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 [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/datamapper?hl=en.
>>>
>>
>>
>>
>> --
>> Jean Michel Baldessar
>> Msn: [email protected]
>> 9976-4691
>>
>
>


-- 
Jean Michel Baldessar
Msn: [email protected]
9976-4691

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

Reply via email to