# Using Plugins in Extensions

**URL:** <https://www.ruby-forum.com/t/using-plugins-in-extensions/104563>\
**Category:** Radiant CMS\
**Created:** [May 19, 2007, 5:23pm UTC](https://www.ruby-forum.com/t/using-plugins-in-extensions/104563 "2007-05-19T17:23:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![qrc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/8797f3/32.png) [@qrc](https://www.ruby-forum.com/u/qrc)\
**Post date:** [May 19, 2007, 5:23pm UTC](https://www.ruby-forum.com/t/using-plugins-in-extensions/104563/1 "2007-05-19T17:23:51Z")

</div>

Hi-

I’m working on a banner ad extension for a friend and am currently using  
the  
file\_column plugin (althought I’ve been thinking about using  
attachment\_fu  
instead) to handle the image upload. Right now I’ve just stuck it in  
the  
root app’s vendor/plugins directory. Is this acceptable practice or is  
there a better way to do it? I know the gallery module handles the  
image  
upload manually, but I wanted to stick with a proven method without  
rewriting existing code.

Any thoughts?

Regards,  
Josh

---

<div class="post-metadata">

**Author:** ![qrc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/8797f3/32.png) [@qrc](https://www.ruby-forum.com/u/qrc)\
**Post date:** [May 19, 2007, 5:41pm UTC](https://www.ruby-forum.com/t/using-plugins-in-extensions/104563/2 "2007-05-19T17:41:07Z")

</div>

I’m still a relative Ruby/Rails/Radiant rookie; however, that’s what  
I’ve been doing. I basically ask myself, “Do I want this plugin  
affecting all Radiant instances or just the one instance?” That answer  
determines where I put it. Using the root helps with staying DRY.

---

<div class="post-metadata">

**Author:** ![qrc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/8797f3/32.png) [@qrc](https://www.ruby-forum.com/u/qrc)\
**Post date:** [May 19, 2007, 6:06pm UTC](https://www.ruby-forum.com/t/using-plugins-in-extensions/104563/3 "2007-05-19T18:06:57Z")

</div>

If you want an example of how to integrate a plugin into an extension,  
check out page\_attachments. It’s not especially straightforward…  
you might have to dump code from init.rb of the plugin in the activate  
method of your extension.

Sean

---

<div class="post-metadata">

**Author:** ![qrc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/8797f3/32.png) [@qrc](https://www.ruby-forum.com/u/qrc)\
**Post date:** [May 19, 2007, 6:11pm UTC](https://www.ruby-forum.com/t/using-plugins-in-extensions/104563/4 "2007-05-19T18:11:57Z")

</div>

This is what I have been doing, but I really reccomend shifting to  
attachment\_fu. The killer feature is also that you can have image  
processing without RMagick, which leaks memory and is generally a  
pain. ImageScience, MiniMagick and RMagick are all provided, as well  
as DB and file system storage.

Like Sean said extension. Look at his page\_attachments for some good  
examples. I will be updating some of my own extensions to match the  
new hooks for the views.

Keith B.  
Tel: +49-7731-79838380  
removed\_email\_address@domain.invalid  
[http://keithbingman.com](http://keithbingman.com)
