AppleII717 wrote: [...] > I'm trying to cut down my javascript habits, but sometimes it's just > faster. My next problem is phone numbers. They were stored as string > (10), but the user could use any format they wished. At the end, we > just stripped out the non digits and validated on 10 digits. But when > you are displaying it in the form, 10 straight digits without > formatting is not very user friendly.
Right. > Stripping them out in a before > filter has also become non trivial because of a polymorphic > relationship where the phone number fields don't all use the same > field name. Then this should probably be refactored. > Its is almost faster to use javascript format the phone > number in a display field and put the unformatted number in the real > field. This is a 100% inappropriate use of JS. Regardless of the name of the phone number field, it is trivial to write a helper function to do the formatting on the server side -- and it will work even if the client has JS off. There is no reason at all to use JS here. > > Been "playing" with rails for about 3 years, but the world is more > than generated CRUD So is Rails. > and there is a steep learning curve. Not really -- as long as you don't rely on scaffolding, and as long as you're OK with Ruby itself. > You tend to > fall back to what you know. > > Steve I don't know...I tend to use it as an excuse to learn. YMMV. Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

