views:

184

answers:

3

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 final 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: 

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)

webnuwan
How would I go about embeding it with the view file?
MrCheetoDust
just as the way you would do it normally. (http://www.w3schools.com/flash/flash_inhtml.asp) you can write html in view files. At the end of the day rails view files are transformed to .html files.
webnuwan
+3  A: 

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

Luke Francl
Bingo, thanks guys. (I think that's what you were getting at to webnuwan)
MrCheetoDust
A: 

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.

EmFi