15 Mart 2011, Salı
Link_to ceset gömülü HTML Raylar
Bir bağlantı link_to yöntemi ile oluşturulan gövdesinde HTML gömülü alma hakkında gitmek için en iyi yolu nedir?
Ben temelde şunları istiyor:
<a href="##">This is a <strong>link</strong></a>
Ama hiç şans Rails and the <span> tag önerildiği gibi bu konuda gitmek için çalışıyorum. Benim kod aşağıdaki gibidir:
item_helper.rb
def picture_filter
#...Some other code up here
text = "Show items with " content_tag(:strong, 'pictures')
link_to text, {:pics => true}, :class => 'highlight'
end
item_view.html.erb
#...
<%=raw picture_filter %>
#...
CEVAP
15 Mart 2011, Salı
Bu yolu deneyin
<%= link_to(raw("a <strong>strong</strong> link"),{:pics => true},{ :class => 'highlight'}) %>
Bunu Paylaş:
Kullanarak gömülü HTML ile link_to...
Html yorum bloğu.raylar erb şablonları...
Don'raylar üzerinde yakut t escap...
raylar: kodlamak html/nasıl bir dize k...
nasıl raylar için html kimliği form_ta...