Fill a rails form with a hashmap
Posted
by Ignace
on Stack Overflow
See other posts from Stack Overflow
or by Ignace
Published on 2010-03-15T10:38:08Z
Indexed on
2010/03/15
10:39 UTC
Read the original article
Hit count: 326
Hey,
I have a difficult situation.
I let the the user create a form through a Rich Text Editor and then I save this.
So for example, I save this literally into my DB:
http://pastebin.com/DNdeetJp (how can you post HTML here? It gets interpreted, so now I use pastebin...)
On another page I wrap this in a form_tag and it gets presented as it should be.
What I want to do is save this as a template and save the answers as a hashmap to my DB.
This works well, but the problem is I want to recreate what checkbox/radiobutton/... is selected when the user goes back to the page. So I want to fill the form with the answers from the hashmap.
Is there a way to use a 'dummy' model or something else to accomplish this?
Thanks!
© Stack Overflow or respective owner