"CRUD table" from a model inside another (related) model's new/edit form

Hello list,

Let’s say I have a User model and then a UserPermissions model.

User has_many Permissions.

This is probably not a good design but it is just for the sake of example really.

I would like the UsersController new/edit action form to be something like the following:

url: host/users/new

New User

Name: _____________


Manage Permissions for this User

Add Permisson

object | level |
obj1 | 2 | Delete | Modify
obj2 | 1 | Delete |

User Address_________________

Back Create

As the User and Permissions table are related, the “Permissions table” would have all the permissions of the user being edited or created (A simple Permission.find_all_by_user_id(:id) would do).

However, I’m not sure if this is a good GUI pattern and if yes how could I implement it… I think that the only viable way would be by using Ajax. I’ve been looking at ActiveScaffold and it might be a good and fast way to create this kind of interface pattern, however, I did some quick testes with the render :active_scaffold and it doesn’t seem to work well under the new/edit html form.

Any suggestions would be highly appreciated.

Thanks in advance!


HI Marcelo

Have you tried nested scaffolds in AS ?

Hi CCH, Thanks a lot for the reply,

Have you tried nested scaffolds in AS ?

No, I haven’t, I will have a look right now.