开发者

I need to embed vimeo or some other html in my rails app

Can someone point me in a direction so that I can use embed code in Rails? Sometimes I need to embed a slideshow pro file and sometimes I need to embed a youtube file and sometimes a vimeo file in th开发者_如何学运维e same area for different entries, it would be easiest to use embed code but it keeps stripping the embed code.

Do use a santize plugin? Can someone point me to a tutorial or give me some help to get me started?

thx


Ok, so the plugin was not the answer to my question --

I wanted to simply add embed code to my rails application -- basically in the same area of my site -- sometimes I wanted to add youtube, sometimes, vimeo and sometimes something coming out of slideshow pro director -- a .swf that is fed by an XML feed.

So after a ton of research on this site and many others -- I found there was a simple solution.

escaping html in RAILS.

xss_terminate

http://www.railslodge.com/plugins/910-xss-terminate

xss_terminate is a plugin in that makes stripping and sanitizing HTML stupid-simple. Install and forget. And forget about forgetting to h() your output, because you won't need to anymore.

But xss_terminate is also flexible. By default, it will strip all HTML tags from user input. This is usually what you want, but sometimes you need users to be able to enter HTML. The plugin allows you remove bad HTML with your choice of two whitelist-based sanitizers, or to skip HTML sanitization entirely on a per-field basis.

This plugin did it like a charm -- just remember to remove the h from

<%=h @article.body %> to <%= @article.body %>


Here's a sample rails app with vimeo integration. It looks like it makes use of this great vimeo plugin. From the README:

This gem implements a full-featured Ruby interface for the Vimeo API v2.

Sounds like it might be just the ticket!


I normally just create a body area_input with RedCloth, this allows for simply drop embedment code inas well as text image etc.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜