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

Conversation

Projects
None yet
2 participants
@bernerdschaefer
Contributor

bernerdschaefer commented Jun 7, 2011

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

Merge pull request #567 from bernerdschaefer/master
Improve reloader, now we can work with ActiveSupport::Dependencies disabled

@DAddYE DAddYE merged commit 9ed6b6b into padrino:master Jun 7, 2011

@DAddYE

This comment has been minimized.

Show comment
Hide comment
@DAddYE

DAddYE Jun 7, 2011

Member

Awesome Thanks so much man!

Member

DAddYE commented Jun 7, 2011

Awesome Thanks so much man!

DAddYE added a commit that referenced this pull request Jun 7, 2011

Sometimes require "foo" returns nils also if the file was loaded corr…
…ectly without exceptions or any thing. So is necessary to prevent a false negative #567
@DAddYE

This comment has been minimized.

Show comment
Hide comment
@DAddYE

DAddYE Jun 7, 2011

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@bernerdschaefer

bernerdschaefer Jun 8, 2011

Contributor

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

Contributor

bernerdschaefer commented Jun 8, 2011

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