Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

remixed model repository remains :default #14

Open
1xch opened this issue Oct 11, 2011 · 2 comments
Open

remixed model repository remains :default #14

1xch opened this issue Oct 11, 2011 · 2 comments

Comments

@1xch
Copy link

1xch commented Oct 11, 2011

I've just started working with trying to create different repositories, and I haven't been able to get remixed models to inherit the repository, or change the repository from :default

Using this:

https://gist.github.com/1278627

I can specify a repository for the Ticket model, but TicketComments can not be changed from the methods I've tried. The expected behavior should be for remixed models to inherit the repository of the models remixed from, i.e. TicketComments should inherit the repository of Ticket, but this may be my opinion in this case and I can see where it might not always be the case.

I'm probably missing the obvious method, but going through several times from various directions resulted in no change.

@1xch
Copy link
Author

1xch commented Oct 12, 2011

So, directions tried:

  1. using enhance
    DataMapper.repository(:newrepo) (no effect)
    def self.default_repository_name; :newrepo; end (error for the generated model on automigrate: must have at least one property or many to one relationship to be valid)
    def default_repository_name; :newrepo; end (no effect)

  2. module RemixeeClassMethods (no effect)
    end

  3. in the module to be remixed itself (no effect)

I guess I'm still not 100% about how repository get manipulated, but the methods I've tried tried just get ignored for the remixed model, the same methods that will work for the model doing the remixing.

@1xch
Copy link
Author

1xch commented Oct 12, 2011

I'm not sure I'm missing something (probably), but if this is some functionality that is missing (repository always gets set to :default) there are a number places to think about where to put a method that handles setting the repository for the remixed model: RemixeeClassMethods, within enhance, within the remix method, but I'd just prefer it to be default behavior that gets that can be overridden, remixed models inherit the repository of the model doing the rmixing and if needed overwritten in the 'remix n, :remixables, :repository => :newrepo'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant