# Scaffolding oddities -- any ideas?

**URL:** <https://www.ruby-forum.com/t/scaffolding-oddities-any-ideas/184786>\
**Category:** Rails\
**Created:** [March 8, 2010, 6:28pm UTC](https://www.ruby-forum.com/t/scaffolding-oddities-any-ideas/184786 "2010-03-08T18:28:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [March 8, 2010, 6:28pm UTC](https://www.ruby-forum.com/t/scaffolding-oddities-any-ideas/184786/1 "2010-03-08T18:28:42Z")

</div>

Hi All,

I’ve got a couple of problems and solutions I’ll try unless I get  
guidance for more Rails-like approaches. Details follow.

Thanks is advance,  
Richard

I. Problems and possible solutions:  
The user CRUD works fine except:

1. When user data is supplied and Create is clicked, the  
“successfully created” message appears, but no navigation buttons are  
presented. Of course:  
a) browser navigation is available  
b) coding for that view could be amended, e.g. by copying code from  
the vendor view, which includes the navigation

2. When the Email dropdown field is populated for a new user who is  
then created, subsequent user forms have the Email field quasi-  
populated, i.e. it has a reddish-orange background and a dim  
rendering of the value selected for the previously entered user. If  
that field is not cleared and the new user is created:  
a) the previous user’s email address is carried forward to the new  
user (that behavior may be desirable for some fields but not for  
other, in which case the generated code could be ameliorated, I  
suppose.)  
b) worse, if that email address is not modified, the email control  
is presented on subsequent pages in its reddish-orange glory.  
c) coding for that view could be ameliorated by initializing the email  
control to nil upon entry to that view

II. Relevant code:  
Generated three scaffolds  
ruby script/generate scaffold user username:string first\_name:string  
last\_name:string email:string encrypted\_password:string salt:string

ruby script/generate scaffold vendor nickname:string qbname:string

ruby script/generate controller Home  
That led to  
four app\controllers:  
application\_controller.rb  
home\_controller.rb  
users\_controller.rb  
vendors\_controller.rb:  
config\ routes.rb file:  
ActionController::Routing::Routes.draw do |map|  
map.root :controller =\> “home”, :action =\> “index”  
map.resources :vendors  
map.resources :users

map.root :controller =\> “vendors”  
map.root :controller =\> “users”  
map.resources :users  
map.resources :vendors

map.connect ‘:controller/:action/:id’  
map.connect ‘:controller/:action/:id.:format’  
end  
NOTE: I can’t remember whether or what changes I made to the  
generated routing

III. Computer environment:  
Rails 2.3.5  
Ruby 1.8.6  
WinXP-Pro/SP3  
Firefox 3.6  
MySQL 5.0.37-community-nt  
Mongrel

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [March 9, 2010, 6:31am UTC](https://www.ruby-forum.com/t/scaffolding-oddities-any-ideas/184786/2 "2010-03-09T06:31:04Z")

</div>

I got it straightened out. Thanks anyway in case you looked at my now-  
solved problems.

On Mar 8, 12:27 pm, RichardOnRails
