开发者

Using rails 'vendor' folder for third party plug-in

I have a small third party flash application I'd like to incorporate in my rails app, but I am struggling to get it working properly.

  1. I believe it belongs in vendor opposed to lib, correct?

  2. Let's say I want the flash app to be loaded in my users controller in the signature action, how would I go about loading it in there. The app has multiple files, and lets say the f开发者_Go百科inal page to view is called xyz.html. How can I route/link my signature view to show xyz.html (located in vendor/plugins/sig/mouse/xyz.html) ?

Thanks.


A Flash application needs to be web-viewable to work, right?

Then it should go in the public folder.

Files in that folder will be served up by the web server, bypassing Rails. So the file at public/foobar.html can be found at http://localhost:3000/foobar.html


Does your flash app is another Rails app? By looking at the path you specified (plugins/sig/mouse/xyz.html) I guess it is not. Then you can place your flash files under /public in main Rails app and embed it with the view file. (in your case signature view)


Resources the flash application needs should go in the public folder. You should also create a partial that invokes the flash application which can be rendered from any of your views.

Edit: I understood the question to be about including a 3rd party rails application as if it were a plugin. So the following doesn't exactly apply.

Is the third party application created with Rails Engines?. Engines turn applications into plugins, essentially doing exactly what you're trying to do.

If it wasn't built as an engine you could adapt it to use the Engine framework, simplifying everything you're looking to do. Then it's just a matter of passing the right options to render from the signature action of your users controller.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜