Mam taki scaffold z przerobionym kontrolerem:
Controller
class Admin::ManufacturersController < Admin::BaseController
resource_controller
end
Model + Migracja
[code]class Manufacturer < ActiveRecord::Base
end
class CreateManufacturers < ActiveRecord::Migration
def self.up
create_table :manufacturers do |t|
t.string :name
t.text :description
t.timestamps
end
end
def self.down
drop_table :manufacturers
end
end[/code]
Widoki index, new, show, edit, _form bez przeróbek ze scaffolda
View index.html.erb
[code]…
<% @manufacturers.each do |manufacturer| %>
<%= manufacturer.name %> |
<%= manufacturer.description %> |
<%= link_to 'Show', manufacturer %> |
<%= link_to 'Edit', edit_manufacturer_path(manufacturer) %> |
<%= link_to 'Destroy', manufacturer, :confirm => 'Are you sure?', :method => :delete %> |
<% end %>
...[/code]
W pliku routes.rb wrzuciłem
[code]namespace :admin do
resources :manufacturers
end[/code]
Po odpaleniu .../admin/manufacturers/ dostaje
[code]No route matches {:action=>"show", :controller=>"manufacturers", :id=>#<Manufacturer id: 1, name: "abc", description: "", created_at: "2011-02-25 16:12:54", updated_at: "2011-02
Extracted source (around line #16):
13:
14: <%= manufacturer.name %> |
15: <%= manufacturer.description %> |
16: <%= link_to ‘Show’, manufacturer %> |
17: <%= link_to ‘Edit’, edit_manufacturer_path(manufacturer) %> |
18: <%= link_to ‘Destroy’, manufacturer, :confirm => ‘Are you sure?’, :method => :delete %> |
19:
[/code]
Co powinienem wstawić do routes.rb ?