Tony Arcieri
2009-Oct-06 17:06 UTC
Why does RakeFileUtils get mixed into ActiveRecord::Base?
I''m running into a rather weird problem... I have a model with a "link" attribute that isn''t working because it''s getting clobbered by RakeFileUtils#link It seems as soon as you require ''rake'' that RakeFileUtils gets mixed into ActiveRecord::Base>> require ''active_record''=> true>> RakeFileUtilsNameError: uninitialized constant RakeFileUtils from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/ active_support/dependencies.rb:443:in `load_missing_constant''>> require ''rake''=> ["RakeFileUtils", "FileList", "RAKEVERSION"]>> ActiveRecord::Base.include? RakeFileUtils=> true Any idea how this is happening exactly? Even worse, the accessor method for the attribute seems to be getting eventually defined in what seems to be a magical or non-deterministic manner: http://gist.github.com/202477 First time around: #<Method: Channel(RakeFileUtils)#link> Second time around: #<Method: Channel#link> My gut feeling is that RakeFileUtils really, really does not belong in ActiveRecord::Base
Tony Arcieri
2009-Oct-06 18:42 UTC
Re: Why does RakeFileUtils get mixed into ActiveRecord::Base?
Never mind, this is Rake''s fault. From rake.rb: ############################################################################# # Include the FileUtils file manipulation functions in the top level module, # but mark them private so that they don''t unintentionally define methods on # other objects. include RakeFileUtils private(*FileUtils.instance_methods(false)) private(*RakeFileUtils.instance_methods(false))
Josh K
2009-Oct-20 11:33 UTC
Re: Why does RakeFileUtils get mixed into ActiveRecord::Base?
Hi Tony, I am having the same problem, I have an AR model with a link field which isn''t getting called because of Rake. This only just started happening, what is the best way to solve this issue? Thanks a bundle, Josh On Oct 6, 8:42 pm, Tony Arcieri <basc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Never mind, this isRake''sfault. Fromrake.rb: > > ############################################################################# > # Include the FileUtils file manipulation functions in the top level > module, > # but mark themprivateso that they don''t unintentionally define > methods on > # other objects. > > include RakeFileUtilsprivate(*FileUtils.instance_methods(false))private(*RakeFileUtils.instance_methods(false))