Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.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 4 Koudoku-用户拥有的列表的订阅,rails 4,无方法错误_Ruby On Rails 4_Gem_Nomethoderror - Fatal编程技术网

Ruby on rails 4 Koudoku-用户拥有的列表的订阅,rails 4,无方法错误

Ruby on rails 4 Koudoku-用户拥有的列表的订阅,rails 4,无方法错误,ruby-on-rails-4,gem,nomethoderror,Ruby On Rails 4,Gem,Nomethoderror,这里是轨道n00b。我正在尝试将Koudoku gem(似乎是一种使用stripe添加订阅账单的好方法)集成到rails 4应用程序中;我有用户拥有的列表,但是每个列表都有自己的订阅。因此,一个用户有许多列表,但一个列表只有一个订阅 按照上的自述说明,我运行了rails g koudoku:安装清单(附加到清单vs用户) 我将3个定价计划加载到我的stripe帐户中,并将API密钥加载到rails应用程序中 当我尝试转到定价页面(main_app.pricing_path)时,它抛出以下错误:

这里是轨道n00b。我正在尝试将Koudoku gem(似乎是一种使用stripe添加订阅账单的好方法)集成到rails 4应用程序中;我有用户拥有的列表,但是每个列表都有自己的订阅。因此,一个用户有许多列表,但一个列表只有一个订阅

按照上的自述说明,我运行了rails g koudoku:安装清单(附加到清单vs用户)

我将3个定价计划加载到我的stripe帐户中,并将API密钥加载到rails应用程序中

当我尝试转到定价页面(main_app.pricing_path)时,它抛出以下错误:

NoMethodError in Koudoku::SubscriptionsController#index 
undefined method `subscription' for #<User:0x007fc61f79ecc0>

你知道我错在哪里吗?有人遇到过使用此宝石的初学者指南吗?谢谢

我认为您的问题是在列表中安装,而不是用户。我做那件事一点运气都没有


在用户身上试用,看看这是否有帮助

rails 4安装路由的方式存在一个未解决的问题。看起来有一个拉取请求挂起

修正:==>你能让它工作吗?
def index

  # don't bother showing the index if they've already got a subscription.
  if current_owner and current_owner.subscription.present?
    redirect_to koudoku.edit_owner_subscription_path(current_owner, current_owner.subscription)
  end

  # Load all plans.
  @plans = ::Plan.order(:display_order).all

  # Don't prep a subscription unless a user is authenticated.
  unless no_owner?
    # we should also set the owner of the subscription here.
    @subscription = ::Subscription.new({Koudoku.owner_id_sym => @owner.id})
    # e.g. @subscription.user = @owner
    @subscription.send Koudoku.owner_assignment_sym, @owner
  end

end