-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makes form_helper use overriden model accessors backport
[#3374]
- Loading branch information
1 parent
27651c1
commit 8141f08
Showing
2 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8141f08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine to add this to Rails 3, but I don't think it's a good idea to backport this to Rails 2.3. It's a major change of behavior. In the past I have taken full advantage of the fact that facade methods are not used to generate form values. This change causes breakages all over, and I have a feeling it may affect a lot of people. After all, this was not a bug -- this particular behavior has been documented in books, blog posts etc. Can you please re-consider this change for 2.3?
8141f08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with feldpost on this one. In addition to this, the method is called "value_BEFORE_type_cast", but it does deliver the value AFTER the type cast. This is misleading at best.
8141f08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1.
When validation errors happen on form, the form needs to display the invalid value. This code change prevents us from showing user entered invalid value. A case in point is any invalid numeric value gets turned into 0.0 (after the type cast).
8141f08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has now been reverted in 2-3-stable
8141f08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Michael.
8141f08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thank you!
8141f08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why hasn't this been reverted in Rails 3 too? Is the failed-validation behaviour not a problem there?
8141f08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After discussing this we agreed to revert this behavior everywhere. So i'm reverting this on Rails 3 too