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

Models in Rails Engines Erroring (1.2.0, I think) #175

Closed
jkestr opened this issue Jan 14, 2012 · 3 comments
Closed

Models in Rails Engines Erroring (1.2.0, I think) #175

jkestr opened this issue Jan 14, 2012 · 3 comments
Milestone

Comments

@jkestr
Copy link

jkestr commented Jan 14, 2012

I've been running into an issue with existing models and engines I have built from previous versions of DataMapper.

It appears with 1.2.0, it is no longer possible to have models inside of an engine without explicitly calling #finalize on each model. Is this a known issue, and if so are there any work arounds?

DataMapper.finalize does not work in this context, as it does not see the models inside of the engines. I tried creating an initializer that calls finalize on each model, but I ran into issues with Devise not yet being loaded.

What did work was putting .finalize at the bottom of each model definition, but I would rather not have to do that, and I am sure it would only cause other issues with relationships and such.

@solnic
Copy link
Contributor

solnic commented Jan 14, 2012

It seems like dm-rails is not handling engines properly. We'll fix it in 1.3.0 release.

@dkubb
Copy link
Member

dkubb commented Jan 14, 2012

What we need to do is find a hook that executes after all the models are loaded in the engines, but before they get used. We can finalize there, so it only has to be done one time.

I thought we had that for the general case, but maybe there's something different with engines and we need to use a different hook.

@tpitale
Copy link
Member

tpitale commented May 24, 2016

Moved to datamapper/dm-rails#52

@tpitale tpitale closed this as completed May 24, 2016
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

4 participants