这里是 Rails n00b。我正在尝试将 Koudoku gem(似乎是添加带条纹的订阅计费的好方法)集成到 Rails 4 应用程序中;我有由用户拥有的列表,但是每个列表都有自己的订阅。因此,一个用户有多个列表,但一个列表只有一个订阅
按照https://github.com/andrewculver/koudoku处的自述文件说明进行操作,我运行了rails g koudoku:安装列表(附加到列表与用户)
我将 3 个定价计划加载到我的 Stripe 帐户中,并将 API key 加载到 Rails 应用程序中
当我尝试进入定价页面 (main_app.pricing_path ) 时,它抛出以下错误:
NoMethodError in Koudoku::SubscriptionsController#index
undefined method `subscription' for #<User:0x007fc61f79ecc0>
订阅 Controller 中的索引操作是:
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
我哪里出错了?有人遇到过使用这个 gem 的初学者指南吗?谢谢!
最佳答案
rails 4 安装路线的方式存在一个 Unresolved 问题。看起来有一个拉取请求正在等待处理。 https://github.com/andrewculver/koudoku/issues/53
关于ruby-on-rails-4 - Koudoku - 用户拥有的列表的订阅,rails 4,无方法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21104259/