ruby on rails - Using Formtastic to select from a radio set and optionally create a new record -
I have started using Forsterstastic in the last two days and have come in my first head-scratcher.
I am working with items that have some related accounts of each. In the question in the page, you will have to choose a payee account, this can be either an account we already know. ("Main contact") or a new account which you can create by filing short information.
I'm trying to replicate this design:
Using Formattic is very easy to display a form to enter information for a new account. is.
& lt;% = form.inputs: street ,: city ,: = & gt; : Address% & gt;
It is also very easy to create a radio selection list of available accounts.
& lt;% = form.input: address ,: as = & gt; : Radio ,: collection = & gt; @ Address% & gt;
As the picture above, I'm worried about the problem, how to do both - select an existing account or create a new one.
Okay, the real question is how to do both beauty What I thought I think is adding the argument to the controller and I suspect that there is a beautiful solution that I I'm not seeing (recently dipping into the ROR, it's a very familiar sense).
Can not see a solution that does not add some rows to a controller. Although "fat model, thin controller" is a good principle, it is not always possible to have "one-liner" methodical methods, as well as for the scenes the variable is filtered before setting it up.
So what's the "level of beauty" about which we are talking about? ;) Maybe you can post the solution you think and other members will comment on or rate it?
Comments
Post a Comment