addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupsimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1outlookpersonJoin Group on CardStartprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

Fileman Plugin

From: David B.
Sent on: Monday, May 19, 2008 8:44 PM
Fileman Plugin After the last meeting we discussed sharing of plugins and random code that people are messing with so here goes...

My first plugin is called "fileman" and aims at simplifying the process of setting up an attachment_fu model to upload, manage and display that model's files.  This plugin does the grunt work of setting up the initial migration, model, controller, javascript and remote upload code.  You simply configure two or three things in the generated files, add the route and run the migration.

Suppose you have a Document attachment_fu model.  In less than a minute of setup you can enter as little as the following code into your view and have a fully functional fileman instance...

fileman 'Document'

This will display a facility to add new documents and also show those documents in a list, all with remote upload and javascript fades, highlights, etc.

There are a bunch of other options you can easily set right from the view to support single or polymorphic ownership associations, display icons based on mime type, include link names and captions, show uploaded images (if it’s an image model), hide/show the update and delete links, set custom find options that are automatically scoped, behavior for :has_one relationships, etc.

I am sure that the code could use some heavy refactoring, but it is working in production for me.  Currently, it operates as only a generator, though the generated controllers, helper, and fileman views should probably really hook into the application from the plugin...but I have not gotten that far yet.

Anyway, if anyone wants to give it a run it is located on Github.  Git it with...
git clone git://

Also, feel free to ask any questions, refactor, rebuild, demolish, berate, banish, etc.

Best Regards,
David Baldwin
Baldwin Digital
16095 Prosperity Drive, Suite 600
Noblesville, IN 46060
Office:[masked] Ext.202
E-Mail: [address removed]

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy