G
Giles Bowkett
Here's something that's puzzling me.
Somewhere inside Rails is something which loads your .irbrc under some
circumstances. It means that if you have a gem which adds a lot of
methods to Object and which is required by people in their .irbrcs,
sooner or later, your methods on Object are going to collide with
Rails' methods on *anything*. I have such a gem, Utility Belt, and
this happened to somebody who installed it. It's going to happen to a
lot of people, in fact, because the method in question was named
"edit," which practically every Rails app uses.
I took a look around the Rails file-loading process and it looked
pretty involved. I know the problem comes from
ActiveSupport:ependencies but that's about it. I'd like to find and
fix the bug in Rails but I just don't have time. What I want to do
instead is set up Utility Belt to recognize when it's being called
from Rails and then have it de-borkify the situation. All I really
need to accomplish that is code which can recognize where it's being
called or loaded from. I know such code, and idioms for using it,
exist, but I'm not sure what they are. Is it just a matter of grepping
against __FILE__? How does my gem determine who it's being loaded by
and send them away if they don't need to be loading it?
--
Giles Bowkett
Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com
Somewhere inside Rails is something which loads your .irbrc under some
circumstances. It means that if you have a gem which adds a lot of
methods to Object and which is required by people in their .irbrcs,
sooner or later, your methods on Object are going to collide with
Rails' methods on *anything*. I have such a gem, Utility Belt, and
this happened to somebody who installed it. It's going to happen to a
lot of people, in fact, because the method in question was named
"edit," which practically every Rails app uses.
I took a look around the Rails file-loading process and it looked
pretty involved. I know the problem comes from
ActiveSupport:ependencies but that's about it. I'd like to find and
fix the bug in Rails but I just don't have time. What I want to do
instead is set up Utility Belt to recognize when it's being called
from Rails and then have it de-borkify the situation. All I really
need to accomplish that is code which can recognize where it's being
called or loaded from. I know such code, and idioms for using it,
exist, but I'm not sure what they are. Is it just a matter of grepping
against __FILE__? How does my gem determine who it's being loaded by
and send them away if they don't need to be loading it?
--
Giles Bowkett
Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com