Hello Richard,

thank you, for your cheat. It's nice, but
I'm still missing something.

I have a legacy schema like:

class A
 ...
 storage_names[:default] = 'a_table'
 ...
end

class B
 ...
 storage_names[:default] = 'b_table'
 ...
end

My join table is named a_b_table. When I use

has n, :as, :through => Resource

DataMapper look's for a table named "a_bs" .
I tried :through => :a_b_table, but it
doesn't work.

With ActiveRecord I can use :join_table => 'a_b_table'
to override ActiveRecord default nameing convention.

The only way to solve this issue with DataMapper was to
define a model ABTable.

Have I misunderstood you? How can I get rid of the third model?

Regards
Dieter


On 8 Jul., 21:49, Richard Conroy <[email protected]> wrote:
> On Thu, Jul 8, 2010 at 7:49 PM, DSpaeth <[email protected]> wrote:
> > Hello,
>
> > ActiveRecord nows :join_table for has_and_belongs_to_many
> > associations.
> > Does DataMapper also provide a parameter like :join_table for
> > anonymous resources?
>
> > I haven't found anything about this.
>
> > Hi Dieter,
>
> in DataMapper I believe the equivalent syntax is:
>
>  has n, :other_resource, :through => Resource   #anonymous
>
> In this case DataMapper creates a join table on your behalf. It uses naming
> conventions that wouldn't surprise
> anyone used to those in ActiveRecord
>
> 'Resource' can be replaced by a join table of your own making also.
>
> Just dug up: the cheat page for 
> DataMapper:http://cheat.errtheblog.com/s/datamapper/
>
> Check under associations.
>
> Also the main DM page has a mention 
> here.http://datamapper.org/docs/associations.html
>
> Example code would be nice of course. I may be in a position to share some
> of my own in a couple of days -
> doing a project spike with DM that has a couple of many:many relationships.
>
> --http://richardconroy.blogspot.com

-- 
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