Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 274389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:36:10+00:00 2026-05-12T00:36:10+00:00

I let users embed videos from Youtube, Google, Vimeo etc. I thought about the

  • 0

I let users embed videos from Youtube, Google, Vimeo etc. I thought about the best and most secure approach (I don’t want them to be able to include any flash and I also want to restrict the Videosites to exclude free porn websites etc.).

So I thought the best and easiest thing would be to let the user just copy&paste the URL of the video into a text-field, store it in a ExternalVideo Model and then just generate the needed HTML to embed the video.

So my ExternalVideo Model has a function called “embed_html” which should return the proper HTML.

Of course I could do something like this:

def embed_html
  # just a very short example to make my point
  "<embed src='#{@video_source}'>" 
end

But I think that’s bad practice and very unreadable.

My Question: Is there a tool / Gem / Built-in function I can use to generate custom HTML, something like the View Helpers (link_to, image_tag, etc)?

Thanks for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:36:11+00:00Added an answer on May 12, 2026 at 12:36 am

    I would do the following

    def embed_element(external_video)
      content_tag(:embed, '', :src => external_video.video_source)
    end
    

    You should probably check the docs for more information on the content tag method.

    Also note that the content_tag() method will insert a closing tag. Something you seem to be forgetting…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this code to let users embed youtube videos on a website i
I want to let my 'untrusted' users to use wysiwyg plus to embed videos
We want to let users click a thumbs up or thumbs down button from
Google Translate Tools let you embed a translation dropdown in your website that lets
I want to let users upload images from their drives. Searching around the net,
Our software manages libraries, museums, archives etc. We'd like to let the users (namely
What about if I let users insert links to their own host's images, do
I am using the Google Analytics Javascript library to let users view a GeoMap
We let users create ad-hoc queries in our website. We would like to have
I want to let users specify a date that may or may not include

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.