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:
-
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 -
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