【发布时间】:2018-12-06 15:01:03
【问题描述】:
我正在尝试从我的“轨道”模型中呈现适当的元素,该模型是一个名为“流派”的列中的字符串
但是,不是渲染流派;页面改为呈现=track.genre 而不是实际的流派。这是语法错误吗?
index.html.haml(用于视图>曲目)
- content_for :header do
%section.hero.is-warning
.hero-body
.container
%h1.title
Browse the newest Tracks
.instrument-index-grid.pt4
- @tracks.each do |track|
.track.border-light
.track-thumb
=link_to image_tag(track.image_url(:thumb)), track
- if track.genre
.condition
%span.tag.is-dark = track.genre // this renders incorrectly
.pa3
%h3.fw7.f4.title= link_to track.name, track
%p.has-text-gray.fg.pt1
Sold by #{track.user.name}
%p.f3.fw6.has-text-right.pt2.price= number_to_currency(track.price)
- if track_artist(track)
= link_to 'Edit', edit_track_path(track), class: "button is-small"
= link_to 'Delete', track, method: :delete, data: { confirm: "Are you sure ?" }, class: "button is-small"
【问题讨论】:
标签: ruby-on-rails ruby haml