SORU
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ş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Hey Nadine

    Hey Nadine

    24 Kasım 2006
  • hydejiaqi

    hydejiaqi

    12 Mart 2008
  • NewsyTech

    NewsyTech

    2 AĞUSTOS 2010