[英]PayPal-Ruby-SDK model name conflict
我的應用程序中有一個計划模型。 有時我會捕獲以下錯誤。 重新啟動服務器后,它會消失一段時間。
寶石版(1.6.0)
如何解決?
NoMethodError in Subscriptions#index
undefined method `map' for #<PayPal::SDK::REST::DataTypes::PlanList:0x007fbc494c13c0>
Did you mean? tap
-
Rendering subscriptions/index.html.erb within layouts/application
Rendered subscriptions/index.html.erb within layouts/application (3.3ms)
Completed 500 Internal Server Error in 2145ms (ActiveRecord: 8.3ms)
ActionView::Template::Error (undefined method `map' for #<PayPal::SDK::REST::DataTypes::PlanList:0x007fbc494c13c0>
Did you mean? tap):
7: <div class="field">
8: <p class="control has-icons-left is-expanded">
9: <%= form.input_field :plan_id,
10: collection: @plans.map {|plan| ["#{plan.name} - $#{plan.cost}", plan.id]},
11: wrapper_html: { class: ' select is-fullwidth' }, class: 'input', label: false, prompt: 'Select a plan' %>
12: <span class="icon is-small is-left">
13: <i class="fa fa-bars"></i>
app/views/subscriptions/index.html.erb:10:in `block in _app_views_subscriptions_index_html_erb___836818763133109538_70223330120860'
app/views/subscriptions/index.html.erb:2:in `_app_views_subscriptions_index_html_erb___836818763133109538_70223330120860'
訂閱控制器索引操作
def index @plans = Plan.all end
網絡控制台
使用名稱空間而不是包含模塊即可解決此問題。
PayPal::SDK::REST::Payment
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.