-
-
Notifications
You must be signed in to change notification settings - Fork 910
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
validate_length_of does not work when used with associations #1007
Comments
Hey @LukasBarry. When using Regardless of how you are using |
Absolutely, I will get one together and submit it. Thanks! |
Hi, I just came across the same issue and was planning to make changes. But have you already started the change? And is there any update? |
Hey @ysyyork! As you can see here there is a PR here that was submitted. While it's a good start it does need some tests. Unfortunately this issue is low on our priority list at the moment but if you would like to pick it up and supply the tests (submitting a new PR of course) then that would be much appreciated! |
@mcmire Sure, I will give it a look if I have the time. |
Hi all, looks like this issue never got resolved. I have a fresh PR open: #1124 |
Hey folks. In an effort to lighten our load as maintainers and be able to serve you better in the future, the shoulda-matchers team is working on cleaning out the cobwebs in this repo by pruning the backlog. As there are few of us, there are a lot of items that will simply never earn our attention in a reasonable time frame, and rather than giving you an empty promise, we think it makes more sense to focus on more recent issues. That means, unfortunately, that we must close this issue. Don't take this the wrong way: our aim is not to diminish the effort people have made or dismiss problems that have been raised. If you feel that we should reopen this issue, then please let us know so that we can reprioritize it. Thanks! |
Reopening since this is dependent on a PR. |
This commit allows the length matcher to be used on associations. It does this by checking if the attribute is an association, and if so, it uses the associations as the attribute to validate. This commit also test for the length matcher on associations (has_many and has_many through). I want to give credit to @prashantjois for the initial work on this feature. I took his work and expanded on it. Closes thoughtbot#1007
This commit allows the length matcher to be used on associations. It does this by checking if the attribute is an association, and if so, it uses the associations as the attribute to validate. This commit also test for the length matcher on associations (has_many and has_many through). I want to give credit to @prashantjois for the initial work on this feature. I took his work and expanded on it. Closes thoughtbot#1007
This commit allows the length matcher to be used on associations. It does this by checking if the attribute is an association, and if so, it uses the associations as the attribute to validate. This commit also test for the length matcher on associations (has_many and has_many through). I want to give credit to @prashantjois for the initial work on this feature. I took his work and expanded on it. Closes thoughtbot#1007
This commit allows the length matcher to be used on associations. It does this by checking if the attribute is an association, and if so, it uses the associations as the attribute to validate. This commit also test for the length matcher on associations (has_many and has_many through). I want to give credit to @prashantjois for the initial work on this feature. I took his work and expanded on it. Closes #1007
I have been attempting to write a test on a validation for length, and I keep getting the same error. I created a small sample app, as simple as possible, to show the error: Sample Project
Basically, I have a has_many association that must have at least 1, but when I run the test
should validate_length_of(:books).is_at_least(1)
I get the following error:My sample project current models:
And my current test file:
I believe this is because Shoulda is using a string to test length, but I am attempting to test the length of a collection and not a string. However, while attempting to trace it back through the gem, I found nothing that I could use to fix my issue.
Any help would be greatly appreciated. Thanks!
The text was updated successfully, but these errors were encountered: