1
我試圖按照創建Evernote克隆的教程進行操作,但第5行中的這一部分遇到了麻煩,應該將其鏈接迴文檔。當我嘗試運行它,它讓我在文件#指數類型錯誤和「文件中的隱式轉換成整數」:haml中的Rails和href
.wrapper_with_padding
#docs.clearfix
-unless @docs.blank?
- @docs.each do |doc|
%a{href: (url_for[doc])}
.doc
%p.title= link_to doc.title
%p.date= time_ago_in_words(doc.created_at)
%p.content= truncate(doc.content, length:50)
-else
%h2 Create Doc!
%p Start Creating Documents and Organizing Your Life!
%button= link_to "Create Doc", new_doc_path
使用to_s方法在字符串轉換 – uzaif