Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Global lazy_load! and verbose! not working #48

Open
slbug opened this issue Apr 4, 2014 · 1 comment
Open

Global lazy_load! and verbose! not working #48

slbug opened this issue Apr 4, 2014 · 1 comment

Comments

@slbug
Copy link

slbug commented Apr 4, 2014

config/initializers/api.rb

ActiveRestClient::Base.base_url = API::URL
ActiveRestClient::Base.lazy_load!
ActiveRestClient::Base.verbose Rails.env.development?

app/models/person.rb

class Person < ActiveRestClient::Base
  get :all, '/persons'
end

rails console

2.1.0 :001 > Person.all
ActiveRestClient Person:/persons - Trying to read from cache
ActiveRestClient Person#all - Requesting http://site/api/persons
ActiveRestClient Person#all - Response received 20 bytes
ActiveRestClient (80.0ms) Person#all
 => ActiveRestClient::ResultIterator:0x000000099ef7b0

So as you see no verbosity and lazy load.

Same thing if i create own base class and set config.

app/models/my_base.rb

class MyBase < ActiveRestClient::Base
  lazy_load!
  verbose Rails.env.development?
end

app/models/person.rb

class Person < MyBase
  get :all, '/persons'
end
@andyjeffries
Copy link
Contributor

This was intentional and hence it's not documented as working, although I can see why you'd think it would work this way (and FWIW I agree it would be nice if it did it).

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

No branches or pull requests

3 participants