I believe that Mongodb is the right choice for this application, since it does not apply any scheme, it is a good choice for arbitrary data.
, , . .
, (Ruby Mongoid code)
class XForm
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paranoia
field :name, :type => String
field :user, :type => BSON::ObjectId
embeds_many :formfields
end
class Formfields
include Mongoid::Document
field :name, :type => String
field :kind, :type => String
embedded_in :xform
end
, allow_dynamic_fields: true mongoid.yml
,
form = XForm.new(:name=>'test form',:user => current_user.id)
form.formfields << Formfields.new(:name => "Age",:kind=>"Integer", :value => 21)
form.formfields << Formfields.new(:name => "isMarried",:kind=>"Boolean",:value => true)
form.formfields << Formfields.new(:name => "name",:kind=>"String",:value => "ram")
,