在 rails 控制器中包含库时,Paypal SDK Ruby 出错
Paypal SDK Ruby error when including library in rails controller
我正在尝试使用 gem。
首先我安装 gem:
gem 'paypal-sdk-rest', :git => 'https://github.com/paypal/PayPal-Ruby-SDK.git'
那我运行
捆绑包
我也试过
bundle install
和 bundle update
然后我将我的 gem 包含到控制器中并包含 REST Lib 以使其工作
def doPayment
require 'paypal-sdk-rest'
include PayPal::SDK::REST
end
但是当我 运行 doPayment 时,我收到以下错误(请注意,我还没有进行任何付款,只是初始化库)
undefined method `include' for #<UsuarioController:0x007f2b210da040>
我做错了什么?
谢谢
直接在控制器中添加 include PayPal::SDK::REST
而不是像示例那样在控制器方法中添加,
class PostsController < ApplicationController
include PayPal::SDK::REST
我正在尝试使用 gem。
首先我安装 gem:
gem 'paypal-sdk-rest', :git => 'https://github.com/paypal/PayPal-Ruby-SDK.git'
那我运行
捆绑包 我也试过
bundle install
和 bundle update
然后我将我的 gem 包含到控制器中并包含 REST Lib 以使其工作
def doPayment
require 'paypal-sdk-rest'
include PayPal::SDK::REST
end
但是当我 运行 doPayment 时,我收到以下错误(请注意,我还没有进行任何付款,只是初始化库)
undefined method `include' for #<UsuarioController:0x007f2b210da040>
我做错了什么?
谢谢
直接在控制器中添加 include PayPal::SDK::REST
而不是像示例那样在控制器方法中添加,
class PostsController < ApplicationController
include PayPal::SDK::REST