Pergunta

I want the user to be give me an URL that ends with the .mp3 extension and be played in the show page.

I used scaffolding to create the new page for the User to submit the URL, and in the show page I want this URL to be play the associated media file:

<p>
<strong>Music url:</strong>
<%= @profile_music.music_url %>
</p>

If it was an ordinary HMTL page I would use:

<EMBED SRC= "url.mp3" width="360" height="165" HIDDEN=false AUTOSTART=true loop="false" volume="60">

So I need something like:

<EMBED SRC= @profile_music.music_url width="360" height="165" HIDDEN=false AUTOSTART=true loop="false" volume="60">
Foi útil?

Solução

Use this:

<EMBED SRC="<%= @profile_music.music_url %>"
    width="360" height="165" HIDDEN=false AUTOSTART=true loop="false" volume="60">

<%= @profile_music.music_url %> will be interpreted by erb with the actual content.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top