# Standard rails plugins not supported in Radiant?

**URL:** <https://www.ruby-forum.com/t/standard-rails-plugins-not-supported-in-radiant/122145>\
**Category:** Radiant CMS\
**Created:** [December 4, 2007, 10:25pm UTC](https://www.ruby-forum.com/t/standard-rails-plugins-not-supported-in-radiant/122145 "2007-12-04T22:25:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![topherzee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f1d935/32.png) [@topherzee](https://www.ruby-forum.com/u/topherzee)\
**Post date:** [December 4, 2007, 10:25pm UTC](https://www.ruby-forum.com/t/standard-rails-plugins-not-supported-in-radiant/122145/1 "2007-12-04T22:25:45Z")

</div>

Hello,  
Forgive me if this is a stupid or already covered question - i did  
search on  
the radiant site and mailing list, but did not see any conclusive  
answers.

In a nutshell:  
I see that the path to the plugins lib directory is properly added to  
load\_paths by railties/initializer.rb load\_plugins().  
But then the path is completely overwritten in  
radiant/extension\_loader.rb  
discover\_extensions()

Context:  
I am trying use a regular rails plugin “acts\_as\_taggable\_on\_steroids”,  
and  
would like to use several others.  
I dont need to use it as an extension in Radiant - it will be used  
elsewhere  
in the same application. (My app mixes Radiant with a rails app through  
the  
lovely “radiant\_on\_rails”, "share\_layouts, and “record\_tags”  
extensions.)  
It is probably possible to create an extension that wraps it - but I  
would  
prefer not too. It’s nicest (and easiest) if I can just load existing  
rails  
plugins and also keep them up to date as people release new versions.

The problem that I am having is that this plugin has several modules in  
it’s  
lib directory that cannot be discovered by rails  
Dependencies.load\_missing\_constant because the path has been removed  
from  
the Dependencies.load\_paths array by Radiant.

So when I try to use this Plugin I get a  
"  
NameError in TesterController#tagtest

Uninitialized constant  
ActiveRecord::Acts::Taggable::InstanceMethods::TagList  
"

Questions:  
So, are plugins basically not supported in Radiant?  
Is there a reason for that… and is there a reason for totally  
overwritting  
the Dependencies.load\_paths array? Or is this something that could be  
changed, for example that radiant/extension\_loader.rb  
discover\_extensions()  
appends the paths to load\_paths instead of overwriting it?

Thanks for any insight into this!!!  
cheers, topher

–  
Christopher Z.  
removed\_email\_address@domain.invalid  
604-484-9279

---

<div class="post-metadata">

**Author:** ![topherzee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f1d935/32.png) [@topherzee](https://www.ruby-forum.com/u/topherzee)\
**Post date:** [December 4, 2007, 10:49pm UTC](https://www.ruby-forum.com/t/standard-rails-plugins-not-supported-in-radiant/122145/2 "2007-12-04T22:49:25Z")

</div>

It should be loaded. Are you storing it in RAILS\_ROOT/vendor/plugins?  
Have you modified the config.plugin\_paths in config/environment.rb?

Sean

---

<div class="post-metadata">

**Author:** ![topherzee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f1d935/32.png) [@topherzee](https://www.ruby-forum.com/u/topherzee)\
**Post date:** [December 4, 2007, 11:30pm UTC](https://www.ruby-forum.com/t/standard-rails-plugins-not-supported-in-radiant/122145/3 "2007-12-04T23:30:29Z")

</div>

IIRC correctly, what Chris is describing is the reason I had to  
explicitly load the rspec and rspec\_on\_rails plugins in  
config/environments/test.rb. Somewhere along the line (and Chris may  
have identified it), the plugin load paths are getting blown away.

Chris: try adding something like

config.load\_paths \<\< “#{RADIANT\_ROOT}/vendor/plugins/rspec/lib”

(but the path for your plugin) to config/environment.rb in the  
Radiant::Initializer block.

What was the original reason for clearing out the load\_paths? Is it  
something that should be re-examined?

-Andrew

---

<div class="post-metadata">

**Author:** ![topherzee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f1d935/32.png) [@topherzee](https://www.ruby-forum.com/u/topherzee)\
**Post date:** [December 4, 2007, 11:36pm UTC](https://www.ruby-forum.com/t/standard-rails-plugins-not-supported-in-radiant/122145/4 "2007-12-04T23:36:55Z")

</div>

The original reason is so that Radiant can be run from the gem or  
vendor/radiant. Notice line 17-22 of config/environment.rb. However,  
that should not affect plugin paths which are set later on in the file.  
However, you may be onto something here.

Sean

---

<div class="post-metadata">

**Author:** ![topherzee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f1d935/32.png) [@topherzee](https://www.ruby-forum.com/u/topherzee)\
**Post date:** [December 5, 2007, 12:02am UTC](https://www.ruby-forum.com/t/standard-rails-plugins-not-supported-in-radiant/122145/5 "2007-12-05T00:02:44Z")

</div>

Thanks alot for your feedback guys.

My plugin exists in the path:  
myappname\vendor\plugins\myplugin

My environments.rb file looks like:

# Make sure plugins are loaded from lib and vendor

config.plugin\_paths = [  
“#{RAILS\_ROOT}/vendor/plugins”,  
“#{RADIANT\_ROOT}/lib/plugins”,  
“#{RADIANT\_ROOT}/vendor/plugins”  
]

* * *

When I trace through the application - I see that my plugins are  
properly  
added to the Dependencies.load\_path array in the  
initializer.rbload\_plugins() method.

But Dependencies.load\_path gets overwritten here:  
extension\_loader.rb discover\_extensions() method.  
lines 78-88, actually on the last line…  
(initializer.set\_autoload\_paths)

```
 extension_roots.each do |ext_path|
      load_paths = %w(lib app/models app/controllers app/helpers

```

test/helpers).collect { |p| “#{ext\_path}/#{p}” }  
load\_paths \<\< ext\_path  
load\_paths.each { |p| configuration.load\_paths \<\< p;  
$LOAD\_PATH \<\<  
p; }  
configuration.controller\_paths \<\<  
“#{ext\_path}/app/controllers”  
configuration.view\_paths \<\< “#{ext\_path}/app/views”  
@extension\_roots \<\< ext\_path  
end  
initializer.set\_autoload\_paths

* * *

Here is a fix that I have just tried, and seems to work…  
Just in front of the “initializer.set\_autoload\_paths”  
I added the line:  
configuration.load\_paths.concat(Dependencies.load\_paths) #CLZ so that  
rails  
plugins still work??

The set\_autoload\_paths function basically sets Dependencies.load\_paths  
to  
configuration.load\_paths.

* * *

Does this seem sensible? So far it seems to work - but ive just done a  
bit  
of testing.

ps. same issue on 0.6.3 and 0.6.4  
pps. I did just try putting the plugin inside of an extensions plugin  
directory - and that works just fine. The problem is just when i put it  
in  
the plugin directory of the main RAILS\_ROOT app.

-topher

On Dec 4, 2007 2:35 PM, Sean C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > config/environments/test.rb. Somewhere along the line (and Chris may  
> > something that should be re-examined?
> > 
> > > > load\_paths by railties/initializer.rb load\_plugins().  
> > > > in the same application. (My app mixes Radiant with a rails app  
> > > > in it’s  
> > > > ActiveRecord::Acts::Taggable::InstanceMethods::TagList
> > > 
> > > Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

–  
Christopher Z.  
removed\_email\_address@domain.invalid  
604-484-9279

---

<div class="post-metadata">

**Author:** ![topherzee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f1d935/32.png) [@topherzee](https://www.ruby-forum.com/u/topherzee)\
**Post date:** [December 5, 2007, 12:17am UTC](https://www.ruby-forum.com/t/standard-rails-plugins-not-supported-in-radiant/122145/6 "2007-12-05T00:17:22Z")

</div>

Andrew, i tried your suggestion:  
and added the following to environment.rb

config.load\_paths \<\< “#{RAILS\_ROOT}/vendor/plugins/mypluginname/lib”

and that works!  
I see that it is added to the path array properly.  
Thanks!

-topher

On Dec 4, 2007 3:01 PM, Christopher Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ```
> "#{RADIANT_ROOT}/vendor/plugins"
> 
> ```
> 
> )  
> end  
> The set\_autoload\_paths function basically sets Dependencies.load\_paths to  
> the plugin directory of the main RAILS\_ROOT app.
> 
> > The original reason is so that Radiant can be run from the gem or
> > 
> > > have identified it), the plugin load paths are getting blown away.
> > > 
> > > >
> > 
> > to  
> > elsewhere
> > 
> > > > > changed, for example that radiant/extension\_loader.rb
> > > > 
> > > > * * *
> > > 
> > > Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)
> 
> –  
> Christopher Z.  
> removed\_email\_address@domain.invalid  
> 604-484-9279

–  
Christopher Z.  
removed\_email\_address@domain.invalid  
604-484-9279
