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

Need to correctly infer if a relationship is optional or not #2702

Closed
tosbourn opened this issue Aug 27, 2016 · 2 comments
Closed

Need to correctly infer if a relationship is optional or not #2702

tosbourn opened this issue Aug 27, 2016 · 2 comments

Comments

@tosbourn
Copy link
Contributor

In Rails 5 belongs_to relationships are required by default.

However if you just have;

class Model < ApplicationRecord
  belongs_to :other_model
end

Then RailsAdmin marks this field as optional. This can be addressed in the model by doing;

class Model < ApplicationRecord
  belongs_to :other_model, required: true
end

It would be nice if RailsAdmin took into account the version of Rails when deciding if a relationship is required or not.

@ordinaryzelig
Copy link
Contributor

I think the reason is because the validation is actually getting killed somehow. I subitted an issue: #2785.

@tosbourn
Copy link
Contributor Author

tosbourn commented Dec 3, 2016

@ordinaryzelig nice, I will close this issue.

@tosbourn tosbourn closed this as completed Dec 3, 2016
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

2 participants