开发者

How to validation embed video in ruby?

开发者 https://www.devze.com 2023-01-20 05:35 出处:网络
please suggest me a gem or way validation embed video by ruby code. Example: Youtube Video, Google Video开发者_StackOverflow. You may be interested in using oEmbed to get the embed code of whatever th

please suggest me a gem or way validation embed video by ruby code. Example: Youtube Video, Google Video开发者_StackOverflow.


You may be interested in using oEmbed to get the embed code of whatever the user pastes. Here's the Ruby version.


I think a simple WYSIWYG editor would do the trick. We use CKEditor but there are lots of ones out there. A few are jQuery focused, if that is what you are looking into.

This would allow people to enter any embeddable thing, like google form, etc.


I researched the topic and found https://github.com/dejan/auto_html extremely helpful. If you use something like

class Comment < ActiveRecord::Base
  auto_html_for :body do
    html_escape
    image
    youtube(:width => 400, :height => 250)
    link :target => "_blank", :rel => "nofollow"
    simple_format
  end
end

it automatically converts links and videolinks into embed code, very much like e.g. Facebook.

0

精彩评论

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