So is there no way to make it look under RAILS_ROOT/lib (and other
places)? I tried augmenting config.load_paths in my enviornment.rb
There's a way to do it, I just don't know offhand what that way is in
Rails 1.2.6 (which is what Radiant 0.6.7 runs.) If it helps you start
looking, the equivalent in Rails 2.x is:
ActiveSupport::Dependencies.load_paths << File.join(Rails.root, 'lib')
Where you put that is another story. I suspect it'll work somewhere
within config/environment.rb. In fact, due to load order issues you
might not have a choice where it goes since these modifications aren't
part of an extension.
That said, creating an extension isn't that hard and would remove
problems like this one. I'd strongly suggest you look into it once
you've got the project triaged.
j
On May 17, 2010, at 2:12 PM, D.Kreft wrote:
On Mon, May 17, 2010 at 10:49 AM, Josh French <[email protected]>
wrote:
As Anna mentioned, RAILS_ROOT/lib is not in the load path. New
classes & modules are usually contained in extensions.
So is there no way to make it look under RAILS_ROOT/lib (and other
places)? I tried augmenting config.load_paths in my enviornment.rb,
but that seemed to be of null effect. Or is putting things in lib
just a patently bad idea?
But I'm curious as to what you mean by this:
In another radiant project, I have radiant installed under lib/:
If you're loading Radiant from a gem, how did you end up with it
installed in lib?
Well, that's a longer story...I'll try to keep it short.
I've inherited a Radiant 0.6.7 site that I'm trying to get updated
and augmented with all sorts of extensions and plugins. The previous
owner of the project installed radiant under lib/, including some
monkey patches, and froze all of his gem dependencies under vendor/.
So now, I'm trying to get us upgraded and get everything untangled
to make it easier to manage going forward.
To get a bit more specific, the old install made some monkey
patches (at least I think that's what they are) to standard_tags.rb
which are in a file at 'app/models/standard_tags.rb'. I'm not sure
why he did this (they look like custom tags, not behavior changes to
StandardTags), but of course 'app/models' isn't in the include path,
so they're not getting picked up, thus causing the site to break.
I'm not sure if I want to tackle turning this into an extension just
yet (I'd like to minimize the number of changes I make at each
step), so how would I go about applying this monkey patch?
Thanks a ton for your help thus far!
-dan