Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With AS::Dependencies disabled, loading models can fail #567

Merged
merged 1 commit into from Jun 7, 2011
Merged

With AS::Dependencies disabled, loading models can fail #567

merged 1 commit into from Jun 7, 2011

Conversation

bernerdschaefer
Copy link
Contributor

Given a setup like this:

# app/models/account.rb
class Account
  include Mongoid::Document

  field :api_key, type: ApiKey
  field :name
end

# app/models/api_key.rb
class ApiKey
end

# app/models/user.rb
class User < Account
end

Before this patch, the User model would have no declared fields, because it
inherited from Account before any field declarations could be executed.

Note that this failure is masked in environments where
activesupport/dependencies is required, because AS handles this case already.
You can, however, replicate this in an AS-enabled environment by setting
ENV["NO_RELOAD"].

DAddYE added a commit that referenced this pull request Jun 7, 2011
Improve reloader, now we can work with ActiveSupport::Dependencies disabled
@DAddYE DAddYE merged commit 9ed6b6b into padrino:master Jun 7, 2011
@DAddYE
Copy link
Member

DAddYE commented Jun 7, 2011

Awesome Thanks so much man!

DAddYE added a commit that referenced this pull request Jun 7, 2011
…ectly without exceptions or any thing. So is necessary to prevent a false negative #567
@DAddYE
Copy link
Member

DAddYE commented Jun 7, 2011

Could you tell me if my latest commit it's fine with yours needs? I tried NO_RELOAD in some of my apps and works well, but all are on AR.

@bernerdschaefer
Copy link
Contributor Author

Yeah. I originally had that, and refactored into the one-liner loaded = require.., so all good for me.

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

Successfully merging this pull request may close these issues.

None yet

2 participants