Skip to content

Commit

Permalink
Fix incorrect_dependent_option checker for broken associations
Browse files Browse the repository at this point in the history
  • Loading branch information
fatkodima committed Dec 17, 2024
1 parent b0d597f commit a344484
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def detect
associated_models: [through_association.klass.name],
associated_models_type: "join"
)
next
end
next
end

associated_models, associated_models_type =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,25 @@ def test_has_through_associations_when_join_model_incomplete
OUTPUT
end

def test_has_through_associations_with_bad_source
Context.create_table(:users).define_model do
has_many :posts
has_many :comments, through: :posts, source: :non_existent
end

Context.create_table(:posts) do |t|
t.references :users
end.define_model do
has_many :comments
end

Context.create_table(:comments) do |t|
t.references :posts
end.define_model

refute_problems
end

def test_destroy_async_and_foreign_key_exists
Context.create_table(:companies) do
end.define_model do
Expand Down

0 comments on commit a344484

Please sign in to comment.