Re: [Rails-core] SimpleDelegator autoloading issue

2014-03-02 Thread Henrik Nyh
On Sun, Mar 2, 2014 at 10:20 PM, Henrik Nyh wrote: > On Sun, Mar 2, 2014 at 8:11 PM, Xavier Noria wrote: > >> I believe the culprit here is Delegator. >> Delegator owns const_missing, it is all or nothing (reproduced from >> memory): >> but it should not in my view: after trying its heuristic it

Re: [Rails-core] SimpleDelegator autoloading issue

2014-03-02 Thread Henrik Nyh
On Sun, Mar 2, 2014 at 8:11 PM, Xavier Noria wrote: > I believe the culprit here is Delegator. > > Delegator owns const_missing, it is all or nothing (reproduced from > memory): > but it should not in my view: after trying its heuristic it should > delegate to super if defined in case there are m

Re: [Rails-core] SimpleDelegator autoloading issue

2014-03-02 Thread Xavier Noria
I believe the culprit here is Delegator. Delegator owns const_missing, it is all or nothing (reproduced from memory): class Delegator < BasicObject def self.const_missing(cname) ::Object.const_get(cname) end end but it should not in my view: after trying its heuristic

Re: [Rails-core] SimpleDelegator autoloading issue

2014-03-02 Thread Henrik Nyh
I modified my blog post to implement a RailsySimpleDelegator that appears to handle both stdlib constant lookup and Rails autoloading: http://thepugautomatic.com/2014/03/simpledelegator-autoloading-issues-with-rails/ Maybe it would be the lesser of two evils to have Rails monkeypatch SimpleDelegat

Re: [Rails-core] SimpleDelegator autoloading issue

2014-03-02 Thread Henrik Nyh
Oh, good call with BasicObject. I see its docs ( http://www.ruby-doc.org/core-2.1.1/BasicObject.html) mention this exact case: Access to classes and modules from the Ruby standard library can be obtained in a BasicObject subclass by referencing

Re: [Rails-core] SimpleDelegator autoloading issue

2014-03-02 Thread Xavier Noria
Interesting. The problem is that the const_missing in Delegator issues ::Object.const_get by hand. Essentially this is the situation (modulus I still need coffee :): class Object def self.const_missing(cname) 1 end end class C < BasicObject def self.const_missing(cname)

[Rails-core] SimpleDelegator autoloading issue

2014-03-02 Thread Henrik N
I just blogged about an issue where SimpleDelegator in Rails breaks autoloading: http://thepugautomatic.com/2014/03/simpledelegator-autoloading-issues-with-rails/ Any thoughts about how (or if) Rails could solve this? -- You received this message because you are subscribed to the Google Groups