Html Rails在haml代码中打印ruby字符串
嘿,我对网络编程相当陌生,所以请原谅我的无知。 在.html.haml视图文件中有以下代码Html Rails在haml代码中打印ruby字符串,html,ruby-on-rails,flash,haml,Html,Ruby On Rails,Flash,Haml,嘿,我对网络编程相当陌生,所以请原谅我的无知。 在.html.haml视图文件中有以下代码 %video{:controls => "controls", :height => "240", :width => "320"} %source{:src => @video_resource.file_path, :type => "video/mp4"}/ %source{:src => @video_resource.file_path, :type
%video{:controls => "controls", :height => "240", :width => "320"}
%source{:src => @video_resource.file_path, :type => "video/mp4"}/
%source{:src => @video_resource.file_path, :type => "video/webm"}/
%source{:src => @video_resource.file_path, :type => "video/ogg"}/
%object{:data => "flashmediaelement.swf", :height => "240", :type => "application/x-shockwave-flash", :width => "320"}
%param{:name => "movie", :value => "flashmediaelement.swf"}/
%param{:name => "flashvars", :value => "controls=true&file=movie.url"}/
= t('html5_video_error')
如何将@video_resource.file_路径放入flashvars对象param file变量(当前设置为movie.url)。我可能误解了它的工作方式 这里需要的是基本的字符串插值,ruby on rails语法如下:
# haml code:
%span= "I am a #{ 'interpolated' } string"
# will render:
<span>I am a interpolated string</span>
这里需要的是基本的字符串插值,ruby on rails语法如下:
# haml code:
%span= "I am a #{ 'interpolated' } string"
# will render:
<span>I am a interpolated string</span>
:value=>“controls=true&file={@video\u resource.file\u path}”
应该这样做:value=>“controls=true&file={@video\u resource.file\u path}”
应该这样做