Skip to content

hotfix: add missing SetupSurveyResponse model (NameError on login)#27

Open
pastoriniMatheus wants to merge 1 commit into
developfrom
hotfix/setup-survey-response-model
Open

hotfix: add missing SetupSurveyResponse model (NameError on login)#27
pastoriniMatheus wants to merge 1 commit into
developfrom
hotfix/setup-survey-response-model

Conversation

@pastoriniMatheus
Copy link
Copy Markdown

@pastoriniMatheus pastoriniMatheus commented May 15, 2026

Resumo

Hotfix extraído da PR #22 (que misturava 3 escopos). O model SetupSurveyResponse não existia mas era referenciado por User.has_one :setup_survey_response, causando NameError no login.

Causa raiz

app/models/user.rb declara has_one :setup_survey_response, dependent: :destroy (linha 81) e setup_survey_completed? (linha 83-85) que acessa a associação. Sem o model file, o Rails levanta NameError: Missing model class SetupSurveyResponse quando tenta serializar o usuário após login.

Correção

Arquivo: app/models/setup_survey_response.rb (3 linhas, novo)

class SetupSurveyResponse < ApplicationRecord
  belongs_to :user
end

Contexto do split

PR #22 carregava 3 escopos não relacionados:

Plano de testes

  • Login funciona sem NameError (testado manualmente)
  • setup_survey_completed? retorna false para usuários sem survey
  • 1 arquivo, escopo limpo, branch baseada em develop

Summary by Sourcery

New Features:

  • Introduce the SetupSurveyResponse ActiveRecord model associated with users to back the existing setup_survey_response relation.

User model declares has_one :setup_survey_response but the model file
was missing, causing NameError when the auth service tried to serialize
the user after login. Added the model class with belongs_to :user.

File: app/models/setup_survey_response.rb (3 lines, new)
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 15, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Introduces the missing SetupSurveyResponse ActiveRecord model to satisfy an existing has_one association on User and prevent a NameError during login.

File-Level Changes

Change Details Files
Add the SetupSurveyResponse model to back the existing User.has_one :setup_survey_response association.
  • Create SetupSurveyResponse ActiveRecord model inheriting from ApplicationRecord
  • Declare belongs_to :user association on SetupSurveyResponse to mirror the has_one on User
app/models/setup_survey_response.rb

Possibly linked issues

  • #[BUG] Login fails with 500 on latest: Missing model class SetupSurveyResponse: PR adds SetupSurveyResponse model referenced by User, directly fixing the NameError 500 on login.
  • #[BUG] evo-auth-service-community:latest - Login fails with NameError: Missing model class SetupSurveyResponse: Yes. PR adds the missing SetupSurveyResponse model that causes the NameError on login described in issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant