-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
Why does acts_as_list override rails validation on it's own field? #269
Comments
We don't do anything to the validations. However, we do do a lot when |
@Loremaster, check if the master branch solves your problem. I think this is related to #272. Please let me know the outcome. |
@Loremaster, can you give me an update? |
Closing because of inactivity. Feel free to request that I reopen it @Loremaster. |
@brendon I could confirm the issue as well. the validation passed via sending valid? directly with attribute assignment:
And I've tried with the context you provided, the validation certainly fails after sending position:
But if we create it directly, the validation works:
|
Hi @jeff-free, the only thing I can think of is to check what the internal instance variable is prior to calling
The code reads like this:
I honestly don't know why we're even bothering with these methods but it could be a legacy thing from before If you feel up to it, I'd be happy to review a PR around removing this and just relying on the built in attribute change functionality since we don't support any Rails versions that don't have this as far as I'm aware :) |
@brendon I'll check it up, thx for the reply! |
Oh I know why we track whether positioned was assigned. It's for the scope change functionality. In the rare case where the scope is change and we want to specifically position the item in the new list at the same position integer as its position in the old scope the dirty tracking won't report that the position value has changed. This method tracks if the position is set as an attribute even if the value hasn't changed. |
Closing due to inactivity. |
Example:
It gives:
If I remove
acts_as_list
from the model then validation works properly:I find such behaviour very confusing. Why does it work like that? Is there any way it can be fixed?
The text was updated successfully, but these errors were encountered: