Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.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 Trello gem向Trello卡添加附件_Ruby On Rails_Ruby_Api_Rubygems_Trello - Fatal编程技术网

Ruby on rails 通过ruby Trello gem向Trello卡添加附件

Ruby on rails 通过ruby Trello gem向Trello卡添加附件,ruby-on-rails,ruby,api,rubygems,trello,Ruby On Rails,Ruby,Api,Rubygems,Trello,我正在使用ruby trello gem,在向卡片添加附件时遇到了一些困难 卡创建没有问题。 增加了检查表,都很好 当我尝试使用创建附件时 Trello::Attachment::create(url:'someURL here') 我得到一个错误:TypeError(没有将nil隐式转换为字符串)。 我是在创建过程中缺少了一些必需的值,还是整个事情都搞错了?您可以在Card类中使用该方法,第一个参数是文件或URL(如您的情况),第二个参数是附件的可选名称 下面是一个工作示例: require

我正在使用ruby trello gem,在向卡片添加附件时遇到了一些困难

卡创建没有问题。 增加了检查表,都很好

当我尝试使用创建附件时
Trello::Attachment::create(url:'someURL here')
我得到一个错误:TypeError(没有将nil隐式转换为字符串)。 我是在创建过程中缺少了一些必需的值,还是整个事情都搞错了?

您可以在Card类中使用该方法,第一个参数是文件或URL(如您的情况),第二个参数是附件的可选名称

下面是一个工作示例:

require "trello"

public_key = "x"
member_token = "x"
board_id = "x"

Trello.configure do |config|
  config.developer_public_key = public_key
  config.member_token = member_token
end

board = Trello::Board.find(board_id)
list = board.lists.first
card = list.cards.first

attachment = card.add_attachment("https://google.com", "Link to Google")

错误是否带有回溯(可能在日志文件中)?如果是,请在此处发布完整错误。另外,您确实确定您提供的URL确实是一个URL,对吗?