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:
######################################################
NoMethodError in Admin/publishers#index
Showing app/views/admin/publishers/index.html.erb where line #8
raised:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each
Extracted source (around line #8):
5: <th>Name</th>
6: </tr>
7:
8: <% @publishers.each do |publisher| %>
9: <tr>
10: <td><%=h
publisher.name %></td>
11: <td><%= link_to 'Show', publisher %></td>
######################################################
And there is no new item insert into database.
Why?~