当前位置: 动力学知识库 > 问答 > 编程问答 >

ruby - Store "schemas" to build custom forms using postgres and rails

问题描述:

I'm building a site using rails that will have 1000s of custom forms. Before we build a form builder user interface, we'll be essentially creating and storing the "schema" manually and using the "schema" to build the form.

I had originally posted this question to help figure out how to create the form from a YAML file: Create a form in rails by reading a yaml file

But after doing some research, it seems like it would be better to store the "schema" in our db and now I'm wondering what the best way is to do that. It seems like there's a "jsonb" type for postgres dbs that I could use - is that better than storing the "schema" as YAML data? And would I use the "bytea" type for this type of data? Are there any thoughts on if it would be better to use JSON or YAML? Also, do I just put the contents of the schema in the db or is there a way to just store a file?

Thanks!

网友答案:

I would use the native Postgres JSON type.

http://www.postgresql.org/docs/devel/static/datatype-json.html

分享给朋友:
您可能感兴趣的文章:
随机阅读: