【问题标题】:Uploading images to different sections of document using paperclip使用回形针将图像上传到文档的不同部分
【发布时间】:2017-06-14 13:40:34
【问题描述】:

我正在尝试使用回形针 gem 上传多个图像,但是当我将 link_ to 标记插入 index.html.haml 文件时遇到此错误。下面是每个文件中的代码供您使用。

index.html.haml

- @tags.each do |tag|
  = link_to (image_tag tag.image.url(:medium)), tag
    %h2= link_to tag.title, tag

错误信息

标签中的名称错误#index 未定义的局部变量或方法 `haml_temp' 对于# 你的意思是? haml_tag

【问题讨论】:

  • 您嵌套的元素不正确,请检查

标签: ruby-on-rails paperclip


【解决方案1】:

用这段代码测试

- @tags.each do |tag|
  = link_to tag do
    = image_tag tag.image.url(:medium)
    %h2= link_to tag.title, tag

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-05-25
    • 1970-01-01
    • 2015-09-08
    • 2011-05-06
    • 2014-08-24
    • 2013-09-09
    • 1970-01-01
    相关资源
    最近更新 更多