How to generate the scaffold by user defined path

when I use ruby script/generate scaffold publisher name:string It's worked correctly.

when I use: ruby script/generate scaffold Admin::publisher name:string The command done and no error. Then I add the following code into routes.rb

   map.namespace :admin do |admin|       admin.resources :publishers   end

The url http://127.0.0.1:3000/admin/publisher/new was correct. but when I push the 'create' button.There is a error message:

The error means what it says, that @publishers is nil. Presumably something has gone wrong in your create method. Have a look in the log (log/development.log) to see if you get any clues. Otherwise you could debug into create and see what is happening. Have a look at the rails guide on debugging (http://guides.rubyonrails.org/) and also the Getting Started guide if you have not already worked through that.

Colin