Ruby 检查资源主机上是否存在映像,如果不存在,则替换为默认映像

Ruby 检查资源主机上是否存在映像,如果不存在,则替换为默认映像,ruby,ruby-on-rails-3.2,asset-pipeline,Ruby,Ruby On Rails 3.2,Asset Pipeline,所以我对ruby有这个问题,下面的代码解释了发生了什么 def image_full(img,options)     if Jjdowns::Application.assets.find_asset("#{img}").nil?       image_full = image_tag("#{img}",options)     else       image_full = image_tag("app/no-image-large.png", options)     end   end

所以我对ruby有这个问题,下面的代码解释了发生了什么

def image_full(img,options)
    if Jjdowns::Application.assets.find_asset("#{img}").nil?
      image_full = image_tag("#{img}",options)
    else
      image_full = image_tag("app/no-image-large.png", options)
    end
  end
我试图做的是运行一个检查,如果我的资产服务器上存在一个映像,那么如果它存在,则显示原始映像。如果在资产服务器上找不到映像,则我希望显示默认映像

此代码块用于显示图像,但有关显示默认图像的部分不起作用

到目前为止,我的研究还没有找到解决这个问题的方法


仅澄清一下,资产服务器是内部“CDN”服务器,默认映像位于资产服务器上。

问题的解决方案如下

def some_image(img,options)
    default_img = "dir_to_image/no-image-filler.png"
    if ("#{img}") != ''
      default_img = "#{img}"
    end
    some_image = image_tag(default_img, options)   
end
这里的关键是,我们有一个外部资产主机运行在一个单独的服务器上,这是最初的问题