Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Categories loophole #73

Open
prettyalana opened this issue Oct 11, 2024 · 0 comments
Open

Fix Categories loophole #73

prettyalana opened this issue Oct 11, 2024 · 0 comments

Comments

@prettyalana
Copy link
Owner

prettyalana commented Oct 11, 2024

Because of how my Category model is set up

  has_many :listings, class_name: "Listing", foreign_key: "category_id", dependent: :destroy
  validates :name, uniqueness: true
end

and the foreign key constraint between the categories and the listings due in part to Listings belongs_to :category, class_name: "Category" relationship. When a category that is associated with listings is deleted, the listing also gets deleted leading to messages also becoming obsolete.

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

No branches or pull requests

1 participant