Marcelo de Moraes Serpa
2007-Sep-24 03:50 UTC
"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: _____________ (...) 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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
CCH
2007-Sep-24 04:44 UTC
Re: "CRUD table" from a model inside another (related) model''s new/edit form
HI Marcelo Have you tried nested scaffolds in AS ? On Sep 24, 11:50 am, "Marcelo de Moraes Serpa" <celose...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Marcelo de Moraes Serpa
2007-Sep-24 12:07 UTC
Re: "CRUD table" from a model inside another (related) model''s new/edit form
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. On 9/24/07, CCH <cch-Z/Eug3sLCsSPzdAsCNHSEg@public.gmane.org> wrote:> > > HI Marcelo > > Have you tried nested scaffolds in AS ? > > > On Sep 24, 11:50 am, "Marcelo de Moraes Serpa" <celose...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > 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. > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---