diff --git a/.database_consistency.todo.yml b/.database_consistency.todo.yml index ed97d539..4fcdc664 100644 --- a/.database_consistency.todo.yml +++ b/.database_consistency.todo.yml @@ -1 +1,5 @@ --- +Profile: + self_ref: + MissingIndexChecker: + enabled: false diff --git a/.rubocop.yml b/.rubocop.yml index 6bf660ba..cf86a759 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,5 @@ +inherit_from: .rubocop_todo.yml + require: - rubocop-capybara - rubocop-performance diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..730b0246 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,14 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2024-07-24 21:43:58 UTC using RuboCop version 1.64.1. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 1 +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/HasManyOrHasOneDependent: + Exclude: + - 'app/models/profile.rb' diff --git a/Gemfile.lock b/Gemfile.lock index e7b5731d..4c10addf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -585,4 +585,4 @@ RUBY VERSION ruby 3.3.3p89 BUNDLED WITH - 2.5.14 + 2.5.16 diff --git a/app/models/profile.rb b/app/models/profile.rb index df389ef0..990b9de0 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -24,6 +24,7 @@ class Profile < ApplicationRecord has_one_attached :image + has_one :self_ref, class_name: "Profile", foreign_key: :id, inverse_of: :self_ref has_one :user, through: :self_ref, source: :profileable, source_type: "User" has_one :speaker, through: :self_ref, source: :profileable, source_type: "Speaker" diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index c2556edd..fd4e1806 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -25,7 +25,7 @@ it "creates a new User" do expect { post :create, params: params }.to change(User, :count).by(1) expect(session[:user_id]).to eq(User.last.id) - expect(response).to redirect_to(root_path) + expect(response).to redirect_to(edit_profile_path) end end