views:

32

answers:

0

I've begun using Formtastic in the last couple days and have come to my first head-scratcher.

I'm working with items that each have a few associated accounts. On the page in question you need to select a payee account. It can either be an account we already know about (the "Main Contact") or a new account that you can create by filling in a little information.

Here's the design I'm trying to replicate:

alt text

Using Formtastic it's very simple to display a form to enter a new account's information.

  <%= form.inputs :street, :city, :for => :address %>

It's also very simple to create a radio selection list of available accounts.

  <%= form.input :address, :as => :radio, :collection => @addresses %>

The problem I'm puzzling over, as the above pic illustrates, is how to do both - select an existing account or create a new one.

Well, the real question is how to do both gracefully. Anything I've thought of seems to add logic to the controller and leaves me suspecting that there's a graceful solution that I'm not seeing (having dived into RoR recently, this is a very familiar feeling).