Autoload ruby
Q = 'Outer'
module Foo
Q = 'Inner'
end
module Foo
module Bar
def self.t1
puts Q
end
end
end
module Foo::Bar
def self.t2
puts Q
end
end
Foo::Bar.t1 #=> Inner
Foo::Bar.t2 #=> Outer
This is because of Module.nesting
Post http://urbanautomaton.com/blog/2013/08/27/rails-autoloading-hell/
This can be solved with autoload in Rails
Written by Dinesh Vasudevan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#