How to validation embed video in ruby?
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.
精彩评论