Yep that does the trick - thanks. I am new to ruby and I do love it coming from 
a Unix/C/C++/Obj/Java background - I do have a question and maybe a datamapper 
criticism based on this little tidbit.

I can live with the requirement of defining the key explicitly considering what 
I am used to, NBD. However if it is required for the results to be valid maybe 
it should fail instead of look like it works. It seems very un-ruby like to 
have this as a requirement and then just produce erroneous results. Generally I 
like how easy it is to use/reuse other peoples code in the ruby community 
because the general philosophy seems to be "if I can figure it out then don't 
require someone else to before using the thing'" - this seems to be a little 
counter to that and.... There does not seem to be anything remotely in the 
quick start docs about this.

Thnks again Jonathan.

RB

On Apr 18, 2010, at 10:27 AM, Jonathan Stott wrote:

> On Sun, 18 Apr 2010 10:20:19 -0400
> Robert Boyer <[email protected]> wrote:
> 
>> Okay - this is really strange - the behavior is inconsistent: Last night 
>> every table was acting the same now 3 tables I had seem to work and one does 
>> not with NO changes. Here is a standalone excerpt and some output just run 
>> from irb
>> 
>> 
>> 
>> require "rubygems"
>> require "dm-core"
>> 
>> $dm = DataMapper.setup(:default, "mysql://root:@photo.rwboyer.com/wordpress")
>> 
>> class TermTax
>>    include DataMapper::Resource
>> 
>>    storage_names[:default] = "rb_term_taxonomy"
>> 
>>    property :term_id, Integer, :field => "term_id"
>>    property :tax, String, :field => "taxonomy"
>> 
>>    #belongs_to :term, :child_key => [ :term_id ]
>> 
>> end 
>> 
> The problem is you don't have a key.  It doesn't have to be a Serial, 
> autoincrementing key, but DataMapper requires that there is some column, or 
> collection of columns, which can act as a unique identifier for the record.  
> These are specified via ':key => true'
> 
> Regards
> Jon
> 
> -- 
> 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.
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to