> 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.
> 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.
Right, but then I discovered I was going the wrong way on my
polymorphic relations. Without going into boring details, I have
several types of users (employees, citizens, customers, etc), each
with different profiles. I used Authlogic and defined the Users with a
poloymorphic loginable type. The mistake I make is trying to edit the
Citizen profile from User. It works, but that's where I ran in to the
phone name problem. Going from the Citizen, I can update the User
attributes and take care of phone stuff in the Citizen controller/
> number in a display field and put the unformatted number in the real
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.
I now agree - well I did before - I was just stuck in a learning mode
that was not working because I took the wrong path.
> 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.
I don't know...I tend to use it as an excuse to learn. YMMV.
I've learned a lot since getting out of the "playing" mode. I just
hate getting stuck trying to do something I know should be simple. As
a few posts have pointed out, my Ruby is kind of weak. I love it, but
don't have enough experience to do much without looking something up
in the docs. Guess I just want to learn faster!