I wanted to save my favorite video in the DB once by creating my own application and embed it when calling it, so I will introduce various methods I searched for.
Choose where to share your favorite YouTube videos
Then embed it and choose the one
The URL for embedding the video will appear, so click Copy
Complete by pasting this directly into HTML (haml)
The finished product looks like this
However, when I posted it to the DB and tried to call it from the haml file, it came out as a character string, so this is a way to solve it.
%iframe#player{frameborder: "0", height:"390", src: (movie.url), type: "text/html", width: "640"}
* This time, I made a movie model and set the column name to url.
Put simply, ・ Save the outer frame as a haml file (size etc. can be changed as you like) ・ Save only the URL part in the DB → call it -Save titles and contents in separate columns
By doing this, it was possible to embed the display when posting to the DB → calling.
This is the URL I used, but it's underlined in blue (no double quotes needed)
The blue underlined URL here didn't work. Probably because it is not the URL for embedding.
As mentioned above, I hope it will be helpful for those who want to implement the same.
Recommended Posts