我试图围绕如何允许用户创建包含所有字段类型的自定义表单.如果有一颗宝石会很棒,但我似乎无法在任何地方找到它.
所以我有这样的数据库设置:
t.integer :form_id
t.string :name
t.string :hint
t.integer :position
t.string :field_type
t.boolean :required
t.integer :size
t.boolean :multiple
t.text :values
t.timestamps
Run Code Online (Sandbox Code Playgroud)
而这几乎就是我的所在.我想不出如何通过field_type进行迭代并返回值,以及将它们与实际填写的表单相关联.
谢谢
是否有一个gem或一种简单的方法从我的开发数据库中获取数据并在Rails 3中填充seed.rb文件?
我正在使用此站点的jQuery多朋友选择器; http://mike.brevoort.com/2010/08/10/introducing-the-jquery-facebook-multi-friend-selector-plugin/
它适用于我需要的东西,除了它不按字母顺序排列朋友.我已经隔离了朋友被从Facebook取出的地方,但不知道如何对它们进行排序.有任何想法吗?
FB.api('/me/friends', function(response) {
$.each(response.data, function(i, friend) {
$("#jfmfs-friend-container").append("<div class='jfmfs-friend' id='" + friend.id +"'><img src='https://graph.facebook.com/" + friend.id + "/picture' /><div class='friend-name'>" + friend.name + "</div></div>");
});
init();
});
Run Code Online (Sandbox Code Playgroud)
感谢大家