未定义的方法`plan_class' for nil:设置Rails Composer后的NilClass

时间:2015-04-21 19:58:30

标签: ruby-on-rails railsapps

当用户尝试注册时,我收到此错误。使用rails composer后我没有更改任何文件,但仍然出错。

<div class="authform">
  <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :role => 'form',
        :class => 'payola-onestep-subscription-form',
        'data-payola-base-path' => payola_path,
        'data-payola-plan-type' => resource.plan.plan_class,
        'data-payola-plan-id' => resource.plan.id}) do |f| %>
    <h3>Sign up</h3>
    <div>
      <br />
      <span id="error_explanation" class="payola-payment-error"></span>

1 个答案:

答案 0 :(得分:0)

使用

resource.class

而不是

resource.plan.plan_class