[Rails-core] Re: Make model.number = "1 234" store 1234 instead of 1?

2009-10-26 Thread Jason King
On Oct 26, 2009, at 8:38 AM, Henrik N wrote: > I can think of no case when a space can't be just dropped from numeric > input without losing anything. What we'd lose is consistency in our framework. It would be an error to try to provide you with use-cases for why this is a bad idea. To do so

[Rails-core] Re: Make model.number = "1 234" store 1234 instead of 1?

2009-10-26 Thread Xavier Noria
On Mon, Oct 26, 2009 at 4:38 PM, Henrik N wrote: > I would like to see specific examples of why it might be a bad idea to > remove the spaces. I'm hearing nays but I don't get what issues you > see with this. I do see the benefits, though: more intuitive and human- > friendly input handling. He

[Rails-core] Re: Make model.number = "1 234" store 1234 instead of 1?

2009-10-26 Thread Henrik N
On Oct 26, 2:43 pm, Xavier Noria wrote: > On Mon, Oct 26, 2009 at 1:48 PM, Henrik N wrote: > > On Oct 26, 1:09 pm, Xavier Noria wrote: > >> Don't see this in core. > > >> Looks like a custom numerification that makes sense in your > >> application. Both that one and Rails' make arbitrary assump

[Rails-core] Re: Make model.number = "1 234" store 1234 instead of 1?

2009-10-26 Thread Xavier Noria
On Mon, Oct 26, 2009 at 1:48 PM, Henrik N wrote: > On Oct 26, 1:09 pm, Xavier Noria wrote: >> Don't see this in core. >> >> Looks like a custom numerification that makes sense in your >> application. Both that one and Rails' make arbitrary assumptions about >> what they tolerate, but Rails is c

[Rails-core] Re: Make model.number = "1 234" store 1234 instead of 1?

2009-10-26 Thread Henrik N
Thanks for the feedback, all. Can anyone think of a specific example of when the behavior I proposed would be undesirable? I can't think of anything. For most users, I imagine the suggested behavior follows the principle of least surprise and the current behavior does not. End users likely care

[Rails-core] Re: Make model.number = "1 234" store 1234 instead of 1?

2009-10-26 Thread Amol Hatwar
On Oct 26, 2009, at 5:39 PM, Xavier Noria wrote: > > On Mon, Oct 26, 2009 at 10:17 AM, Henrik N wrote: > >> Since our users have been complaining about putting "1 234" in a form >> and having 1 stored instead of 1234 (because of how to_i/to_f works), >> I made a simple monkeypatch to get their

[Rails-core] Re: Make model.number = "1 234" store 1234 instead of 1?

2009-10-26 Thread Xavier Noria
On Mon, Oct 26, 2009 at 10:17 AM, Henrik N wrote: > Since our users have been complaining about putting "1 234" in a form > and having 1 stored instead of 1234 (because of how to_i/to_f works), > I made a simple monkeypatch to get their expected behavior: Don't see this in core. Looks like a c

[Rails-core] Re: Make model.number = "1 234" store 1234 instead of 1?

2009-10-26 Thread Nicolás Sanguinetti
On Mon, Oct 26, 2009 at 7:17 AM, Henrik N wrote: > > Since our users have been complaining about putting "1 234" in a form > and having 1 stored instead of 1234 (because of how to_i/to_f works), > I made a simple monkeypatch to get their expected behavior: > > This is not something that should go

[Rails-core] Re: Make model.number = "1 234" store 1234 instead of 1?

2009-10-26 Thread Amos King
I think if you are validating numercality it should be an error. Removing spaces seems like unexpected behavior to me. On Mon, Oct 26, 2009 at 4:17 AM, Henrik N wrote: > > Since our users have been complaining about putting "1 234" in a form > and having 1 stored instead of 1234 (because of how

[Rails-core] Make model.number = "1 234" store 1234 instead of 1?

2009-10-26 Thread Henrik N
Since our users have been complaining about putting "1 234" in a form and having 1 stored instead of 1234 (because of how to_i/to_f works), I made a simple monkeypatch to get their expected behavior: https://gist.github.com/3d99d172175ee3bc64a1 I'd be happy to submit a patch to Rails, but I want