Building an extension framework for a Rails app
Posted
by obvio171
on Stack Overflow
See other posts from Stack Overflow
or by obvio171
Published on 2010-04-03T02:48:48Z
Indexed on
2010/04/03
2:53 UTC
Read the original article
Hit count: 368
I'm starting research on what I'd need in order to build a user-level plugin system (like Wordpress plugins) for a Rails app, so I'd appreciate some general pointers/advice. By user-level plugin I mean a package a user can extract into a folder and have it show up on an admin interface, allowing them to add some extra configuration and then activate it.
What is the best way to go about doing this? Is there any other opensource project that does this already? What does Rails itself already offer for programmer-level plugins that could be leveraged? Any Rails plugins that could help me with this?
A plugin would have to be able to:
- run its own migrations (with this? it's undocumented)
- have access to my models (plugins already do)
- have entry points for adding content to views (can be done with content_for and yield)
- replace entire views or partials (how?)
- provide its own admin and user-facing views (how?)
- create its own routes (or maybe just announce its presence and let me create the routes for it, to avoid plugins stepping on each other's toes)
Anything else I'm missing?
Also, is there a way to limit which tables/actions the plugin has access to concerning migrations and models, and also limit their access to routes (maybe letting them include, but not remove routes)?
P.S.: I'll try to keep this updated, compiling stuff I figure out and relevant answers so as to have a sort of guide for others.
© Stack Overflow or respective owner