# Rails Scaffold for Existing Model

**URL:** <https://www.ruby-forum.com/t/rails-scaffold-for-existing-model/177135>\
**Category:** Rails\
**Created:** [October 12, 2009, 10:29am UTC](https://www.ruby-forum.com/t/rails-scaffold-for-existing-model/177135 "2009-10-12T10:29:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raji](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/eb8c5e/32.png) [@raji](https://www.ruby-forum.com/u/raji)\
**Post date:** [October 12, 2009, 10:29am UTC](https://www.ruby-forum.com/t/rails-scaffold-for-existing-model/177135/1 "2009-10-12T10:29:30Z")

</div>

I’ve got a Rails app with a ‘User’ model and a ‘users’ controller.

The users controller handles user registration in the Rails app.

I’d like to build a user admin feature using a namespaced controller  
titled ‘admin/users’. Since all I need are the basic CRUD functions,  
is it possible to generate a scaffold for the User model in the ‘admin/  
users’ controller?

---

<div class="post-metadata">

**Author:** ![raji](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/eb8c5e/32.png) [@raji](https://www.ruby-forum.com/u/raji)\
**Post date:** [October 13, 2009, 4:07pm UTC](https://www.ruby-forum.com/t/rails-scaffold-for-existing-model/177135/2 "2009-10-13T16:07:27Z")

</div>

Hi there,

I’ve actually just started working on a gem I call “ViewMapper” that  
creates view scaffolding from existing models:

[http://patshaughnessy.net/view\_mapper](http://patshaughnessy.net/view_mapper)

It can create the standard CRUD scaffolding you’re looking for, or  
setup views that work with other plugins/gems like auto\_complete,  
paperclip, etc. It won’t support specifying a namespace, although  
that’s an interesting idea. You will have to:

1. Move/rename your existing users controller and view code; leave the  
user model there
2. Use view mapper to create a new controller/view for users
3. Move the new one to admin/users and restore your old code.

- pat

---

<div class="post-metadata">

**Author:** ![raji](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/eb8c5e/32.png) [@raji](https://www.ruby-forum.com/u/raji)\
**Post date:** [October 13, 2009, 5:45pm UTC](https://www.ruby-forum.com/t/rails-scaffold-for-existing-model/177135/3 "2009-10-13T17:45:48Z")

</div>

is there any options for scaffold script?
