# "CRUD table" from a model inside another (related) model's n

**URL:** <https://www.ruby-forum.com/t/crud-table-from-a-model-inside-another-related-models-n/115341>\
**Category:** Rails\
**Created:** [September 24, 2007, 5:51am UTC](https://www.ruby-forum.com/t/crud-table-from-a-model-inside-another-related-models-n/115341 "2007-09-24T05:51:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [September 24, 2007, 5:51am UTC](https://www.ruby-forum.com/t/crud-table-from-a-model-inside-another-related-models-n/115341/1 "2007-09-24T05:51:39Z")

</div>

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: \_\_\_\_\_\_\_\_\_\_\_\_\_  
(…)

Permissions

Manage Permissions for this User

Add Permisson

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

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!

Marcelo.

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [September 24, 2007, 6:45am UTC](https://www.ruby-forum.com/t/crud-table-from-a-model-inside-another-related-models-n/115341/2 "2007-09-24T06:45:43Z")

</div>

HI Marcelo

Have you tried nested scaffolds in AS ?

On Sep 24, 11:50 am, “Marcelo de Moraes S.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [September 24, 2007, 2:09pm UTC](https://www.ruby-forum.com/t/crud-table-from-a-model-inside-another-related-models-n/115341/3 "2007-09-24T14:09:00Z")

</div>

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.

Thanks.

Marcelo.
