Devise NoMethodError - неопределенный метод registrations_url - PullRequest
1 голос
/ 09 апреля 2020

Я обновляю проект ruby, так же как я обновил версию devise gem. Старая версия была devise (3.4.1) и обновлена ​​до devise (4.7.1). Теперь, когда я пытаюсь зарегистрироваться, я получаю Ошибка

NoMethodError - undefined method `registrations_url' for #<DeviseOverrides::RegistrationsController:0x00007fb030a780b8>
Did you mean?  registration_url
               registration_path
               new_registration_url:

Разработка маршрутов

DeviseOverrides :: RegistrationsController

class DeviseOverrides::RegistrationsController < DeviseInvitable::RegistrationsController
  def new
    reg_params = params[:registration] ? prefilled_registration_params : {}
    build_resource(email: reg_params[:email])
    respond_with self.resource
  end

  private

  def prefilled_registration_params
    params.require(:registration).permit(:email)
  end

  def build_resource(hash=nil)
    self.resource = Registration.new(hash || {})
  end

  def sign_up(resource_name, resource)
    sign_in(resource_name, resource.user)
  end

  def after_sign_up_path_for(resource)
    edit_org_dashboard_plan_url(resource.org, from_sign_up: true)
  end

  def sign_up_params
    params
      .require(:user)
      .permit(:email, :password, :password_confirmation,
              :email_confirmation, :first_name, :last_name,
              :telephone, :terms_of_service_and_privacy_policy, :org_name)
  end
end

новый. html .haml

.col-md-6
  .form
    .form-divider
      .line-icon.icon-pencil
      %h2.title Create new account
    = simple_form_for(resource, as: resource_name, url: registration_path(resource_name) ) do |f|
      .form-inline.row
        .col-sm-12.sign__up__form{'ng-controller' => 'OrgUrlPreviewCtrl', 'ng-init' => "init('#{escape_javascript(resource.org_name)}')"}
          = f.input :email, autofocus: true
          = f.input :email_confirmation
          = f.input :first_name
          = f.input :last_name
          = f.input :password
          = f.input :org_name, label: 'Account Name',
            required: true,
            input_html: { 'ng-model' => 'orgName' }
          = f.input :org_url, as: :string, wrapper: :prepend do
            .input-group
              %span.input-group-addon http://
              = f.input_field :org_url,
                readonly: true,
                as: :string,
                'ng-model' => 'predictedOrgSlug'
              %span.input-group-addon #{root_url.remove("http://")}

          = f.input_field :terms_of_service_and_privacy_policy,
            as: :boolean
          = f.label :terms_of_service_and_privacy_policy, terms_of_service_and_privacy_policy_label, class: 'inline-label privacy-label'
          = f.error :terms_of_service_and_privacy_policy, id: 'user_terms_of_service_and_privacy_policy_error'
      .form-actions.row
        = f.button :submit, "Get started", class: 'btn-orange'

Примечание : я перезагружал сервер несколько раз.

Работало до обновления самоцвета. Будем благодарны за любые предложения по этому вопросу!

...