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

Not validating belongs_to #343

Open
pardeyke opened this issue Oct 26, 2024 · 0 comments
Open

Not validating belongs_to #343

pardeyke opened this issue Oct 26, 2024 · 0 comments

Comments

@pardeyke
Copy link

I have a model like this:

class HumanResource < ApplicationRecord
  acts_as_tenant :tenant

  belongs_to :project, optional: true
  belongs_to :event, optional: true
  belongs_to :user, optional: true
  belongs_to :job, optional: true
end 

These are all optional but validated so that :project and :event can't be nil at the same time. Same goes for :user and :job.
When creating a new HumanResource and passing ids for Users or Jobs from another Tenant these are stored in the db and not validated. Am I doing something wrong here or what is it?

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