Rails - Google Translate API : ArgumentError: unknown keyword: project
Rails - Google Translate API : ArgumentError: unknown keyword: project
我的 rails 应用程序正在使用此代码,该应用程序使用 google 翻译 API,但在我最后一次提交到 heroku 时,我收到了错误
ArgumentError: unknown keyword: project
我的 google 分析似乎也不起作用。不知道是什么导致了错误。也许你有提示?
translate = Google::Cloud::Translate.new project: "my_project"
description_translation = translate.translate params[:description], to: 'en'
update_attribute(:description, description_translation)
project
是 project_id
的别名。是图书馆的deprecated since version 1.1.0
。
您的代码可能已停止工作,因为您将库更新为 version 2.0.0
(or above) - since here, in this PR,对 project
参数的支持已完全删除。
要修复此错误,只需将 project
重命名为 project_id
。
另请注意任何其他可能具有破坏性的更改 here, in the CHANGELOG。如 link 所示,如果出现进一步的复杂情况,您可能希望暂时使用 version: :v2
来帮助简化迁移。
我的 rails 应用程序正在使用此代码,该应用程序使用 google 翻译 API,但在我最后一次提交到 heroku 时,我收到了错误
ArgumentError: unknown keyword: project
我的 google 分析似乎也不起作用。不知道是什么导致了错误。也许你有提示?
translate = Google::Cloud::Translate.new project: "my_project"
description_translation = translate.translate params[:description], to: 'en'
update_attribute(:description, description_translation)
project
是 project_id
的别名。是图书馆的deprecated since version 1.1.0
。
您的代码可能已停止工作,因为您将库更新为 version 2.0.0
(or above) - since here, in this PR,对 project
参数的支持已完全删除。
要修复此错误,只需将 project
重命名为 project_id
。
另请注意任何其他可能具有破坏性的更改 here, in the CHANGELOG。如 link 所示,如果出现进一步的复杂情况,您可能希望暂时使用 version: :v2
来帮助简化迁移。