Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 仅当图像为';有空吗_Ruby On Rails_Paperclip - Fatal编程技术网

Ruby on rails 仅当图像为';有空吗

Ruby on rails 仅当图像为';有空吗,ruby-on-rails,paperclip,Ruby On Rails,Paperclip,如何编辑下面的代码,因此如果没有@business.logo可用,则没有代码 = image_tag @business.logo(:thumbnail), :class=> "img-rounded" 当前未上载任何图像时显示: <img alt="Thumbnail" class="img-rounded" src="http://s3.amazonaws.com/callred/businesses/logos/000/000/034/thumbnail/">

如何编辑下面的代码,因此如果没有@business.logo可用,则没有代码

= image_tag @business.logo(:thumbnail), :class=> "img-rounded"
当前未上载任何图像时显示:

<img alt="Thumbnail" class="img-rounded"   src="http://s3.amazonaws.com/callred/businesses/logos/000/000/034/thumbnail/">

更新

应该询问
是否@business.logo.present?

@business.logo
返回始终为真的
回形针::附件
对象

更新

应该询问
是否@business.logo.present?

@business.logo
返回始终为真的
回形针::附件
对象

更新

应该询问
是否@business.logo.present?

@business.logo
返回始终为真的
回形针::附件
对象

更新

应该询问
是否@business.logo.present?


@business.logo
返回始终为真的
回形针::附件
对象

明白了!这是对我有用的代码

- if @business.logo.present?
  = image_tag @business.logo(:thumbnail), :class=> "img-rounded"

明白了!这是对我有用的代码

- if @business.logo.present?
  = image_tag @business.logo(:thumbnail), :class=> "img-rounded"

明白了!这是对我有用的代码

- if @business.logo.present?
  = image_tag @business.logo(:thumbnail), :class=> "img-rounded"

明白了!这是对我有用的代码

- if @business.logo.present?
  = image_tag @business.logo(:thumbnail), :class=> "img-rounded"

当我尝试这样做时,空图像块仍然存在。=图像标记(@business.logo(:缩略图),:class=>“img圆角”)除非@business.logo.blank?当我尝试这样做时,空图像块仍然存在。=图像标记(@business.logo(:缩略图),:class=>“img圆角”)除非@business.logo.blank?当我尝试这样做时,空图像块仍然存在。=image_标记(@business.logo(:缩略图),:class=>“img四舍五入”)除非@business.logo.blank?当我尝试这样做时,空图像块仍然存在。=image_标记(@business.logo(:缩略图),:class=>“img四舍五入”)除非@business.logo.blank?