#1007 ✓resolved
Chris Ottrey

association fails when multiple repositories are used

Reported by Chris Ottrey | August 14th, 2009 @ 03:00 AM | in 0.10.0

see http://gist.github.com/167693

This test uses three different repositories:

  • :fr which has all its table names and columns in french
  • :es which has all its table names and columns in spanish
  • :default which is all in english

The "test_fr_city" works with the people association,
but last test "test_es_city" fails.

Assuming I have defined the associations for the repositories correctly?,
maybe the association always uses the most recently defined association?

Perhaps that would explain why "test_fr_city" works and "test_es_city" fails?

Comments and changes to this ticket

  • Chris Ottrey

    Chris Ottrey August 16th, 2009 @ 10:33 PM

    Exists in master v0.9.11, but appears to be ok for next v0.10

  • Martin Gamsjaeger (snusnu)

    Martin Gamsjaeger (snusnu) August 18th, 2009 @ 09:12 AM

    • Milestone set to 0.10.0
    • State changed from “new” to “unconfirmed”

    Chris,

    I get errors (although not related to your problem i suppose) when running your tests against latest next branch. Can you definitely confirm this is no problem on next anymore?

  • Chris Ottrey

    Chris Ottrey August 18th, 2009 @ 05:41 PM

    Martin,

    Sorry about that.

    I've changed http://gist.github.com/167693 so that it now works against "next".
    ( http://gist.github.com/167693/cc5ffd180587c7b95c40528a1a6ec97852261c88 )

    So, yes I'd confirm that this is not a problem anymore.

    Although I'm still not quite sure if I'm declaring things properly.
    I would have assumed that http://gist.github.com/170027 would also work.
    ie.
    * (line 53) not needing to define a :default adapter if I don't use one. * (lines 59,73) calling DataMapper.auto_migrate! to create all the tables in that repository

    ( http://gist.github.com/170027/48f5dd9f3906a7de3254cb5b8a19e45bc93a2984 )

    Or am I doing something wrong?

    Cheers,
    Chris

  • Chris Ottrey

    Chris Ottrey August 18th, 2009 @ 08:05 PM

    Oh, I see that DataMapper.auto_migrate! has changed from v0.9.11 to v0.10.

      # @param Symbol repository_name the repository to be migrated
      def auto_migrate!(repository_name = self.repository_name)
    
      # @param [Symbol] name repository to act on, :default is the default
      #
      # @api public
      def auto_migrate!(repository_name = nil)
    

    so I just need to change the two lines in question to:

      DataMapper.auto_migrate!(:es)
    
      DataMapper.auto_migrate!(:fr)
    

    Is there a good design reason for the default changing like this?
    (I liked it better the old way.)

    I'm still wondering why I need to setup a default adapter if I never use it though.
    (ie. line 53)

  • Martin Gamsjaeger (snusnu)

    Martin Gamsjaeger (snusnu) August 18th, 2009 @ 10:09 PM

    • State changed from “unconfirmed” to “resolved”

    Chris,

    I can't really comment on the reason why the default for DataMapper.auto_migrate! changed, I assume Dan knows better. I can confirm that the modified version of your code passes all your tests on latest next branch. Here's the pastie for reference: http://pastie.org/588072

    It's a known limitation currently that you need to setup a :default repository. I was talking to Dan about this in IRC and he said that this is likely to change in the future though.

    Marking this resolved.

  • Chris Ottrey

    Chris Ottrey August 19th, 2009 @ 09:06 PM

    Much appreciated.
    Thanx Martin!

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Pages