I have a Plan model in my app. And sometimes I'm catching the following error. After restarting the server it goes away for a while.
gem version(1.6.0)
How can it be fixed?
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'
subscriptions controller index action
def index
@plans = Plan.all
end
web console
答案 0 :(得分:0)
使用命名空间而不是包含模块可以解决问题。
PayPal::SDK::REST::Payment