Note that there are some explanatory texts on larger screens.

plurals
  1. POMultilevel Complex form with formtastic?
    text
    copied!<p>I have a scenario which needs a very complex form, and i need help in it.</p> <p>I have three tables</p> <pre><code>create_table "permissions", :force =&gt; true do |t| t.boolean "can_read" t.boolean "can_create" t.boolean "can_edit" t.boolean "can_delete" t.integer "role_id" t.integer "resource_id" t.datetime "created_at" t.datetime "updated_at" end create_table "resources", :force =&gt; true do |t| t.string "class_name" t.string "class_action" t.text "description" t.integer "parent_resource" t.datetime "created_at" t.datetime "updated_at" end create_table "roles", :force =&gt; true do |t| t.string "name" t.text "description" t.datetime "created_at" t.datetime "updated_at" end </code></pre> <p>with the models and associations</p> <pre><code>class Role &lt; ActiveRecord::Base has_many :user_roles has_many :users, :through =&gt; :user_roles has_many :permissions def to_s self.name end end class Resource &lt; ActiveRecord::Base has_many :permissions has_many :children, :class_name =&gt; "Resource", :foreign_key =&gt; "parent_resource" scope :root, lambda { { :conditions =&gt; "parent_resource IS NULL" } } end class Permission &lt; ActiveRecord::Base belongs_to :role belongs_to :resource end </code></pre> <p>Suppose we have 2 roles, admin, user, this time, i need a form structure like the image in the <a href="http://picasaweb.google.com/nazarhussain/GeneralPublic?authkey=Gv1sRgCKavn7a6nOShVA#5548818215262471810" rel="nofollow">this link</a></p> <p>How can i make this form? Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload