bellyphantFeed

composed_of getting you down?

Trying to use composed_of for something? Realising that it’s not quite working for you — you need to be able to enter things on forms and actually get them into the database?

You need the Composed Of Conversions plugin. Basically it lets you write a converter block with your composed_of declaration. This means that (to take a wildly relevant example — I’ve been trying to get this to work for a little while now) you can put “AU” in a text box on a form (or a <SELECT>), have that converted to a Country object, then write that to a string column in your database. Seems like a roundabout way of doing things, but it suits what I’m doing at the moment.

Interestingly, the author of that plugin submitted it as a patch to core Rails, but it’s basically been ignored (it seems?). Which is strange, since without it, composed_of is more-or-less useless. (If your attribute has a UI, that is.)

Simon Russell is a software developer from Canberra currently living in London.

Links

Me in other places

Photoblogs

Friends' blogs

Stuff I read

I have to check my RSS reader to finish these links...

Recently del.icio.us links >>

del.icio.us tags