开发者

How to make a public folder in my rails plugin?

How to make a开发者_如何学编程 public folder in my rails plugin?

For example, I have image in /my_rails_app/vendor/plugins/my_plugin/public/edit.gif but in http://localhost:3000/edit.gif i got routing error.


Directly you can't use it. Plugins /public are not merged with main /public folder by default. Generally on deployment it is common to map only main /public but nobody exposes plugin's to viewers.

You have to prepare rake task or generator which copies these files to apps /public folder.

Generally it may be possible to do some routing trickery but generally I'm not recommending it.


You can put the image in public/uploads/edit.gif.

Then you can visit it via

http:// localhost:3000/uploads/edit.gif

I tested on my rails server and it works.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜