Dea*_*ean 20 ruby-on-rails ruby-on-rails-3.2
我需要在我的rails应用程序中为galleria添加数据描述和数据标题,但我看不到如何使用image标签执行此操作.到目前为止我有这个:
<div id="galleria">
<% @entries.each do |entry| %>
<%= image_tag entry.filename, :title => "title", :class => "class", :data-description => entry.caption, :data-title => entry.caption %>
<% end %>
</div>
Run Code Online (Sandbox Code Playgroud)
但这会引发未定义的局部变量或方法`description'错误,那么我如何在rails 3中执行此操作?
jvn*_*ill 46
正确的语法是
<%= image_tag entry.filename, :title => "title", :class => "class", :data => { :description => entry.caption, :title => entry.caption } %>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16519 次 |
| 最近记录: |