Hi I'm just getting into Rails and have come across a problem I can't
find
a solution for.
Basically, answers is a sub resource of questions and you can record an
answer using HTML5's getUserMedia.
The recording is posting fine in the create action, but how can I get it
again for the show action?
The answer controller includes:
def save_file
audio = params[:audio]
save_path = Rails.root.join("public/#{audio.original_filename}")
audio.rewind
File.open(save_path, 'wb') do |f|
f.write audio.read
end
end
The show view includes:
<script>
$('#playsound').click(function (e) {
$('#sound_effect')[0].currentTime = 0;
$('#sound_effect')[0].play();
return false;
});
</script>
<a href="javascript:void(0)" id="playsound">Play
answer</a>
<audio id="sound_effect" class="audio_player"
preload="auto">
<source src=<%= ????????? %> type="audio/wav">
</audio>
Could anyone please hint at what I need to insert into ??????????
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/01ef5e7d-9479-495a-8942-fc4f872d4eaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.