我有数据库表store
型号名称models/store/store.rb
class Store::Store < ActiveRecord::Base
...
end
控制器控制器/商店/maintenance_controller.rb
class Store::MaintenanceController < ApplicationController
def index
@stores = Store.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @stores }
end
end
def new
@store = Store.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @store }
end
end
路线.rb
namespace :store do
root :to => "store#index"
resources :store, :path => 'maintenance', controller: 'maintenance', :as => 'maintenance'
end
rake 路线 |grep 商店
store_root /store(.:format) store/store#index
store_maintenance_index GET /store/maintenance(.:format) store/maintenance#index
POST /store/maintenance(.:format) store/maintenance#create
new_store_maintenance GET /store/maintenance/new(.:format) store/maintenance#new
edit_store_maintenance GET /store/maintenance/:id/edit(.:format) store/maintenance#edit
store_maintenance GET /store/maintenance/:id(.:format) store/maintenance#show
PUT /store/maintenance/:id(.:format) store/maintenance#update
DELETE /store/maintenance/:id(.:format) store/maintenance#destroy
如果我输入 localhost:3000/store 它的工作但是如果我输入 localhost:3000/store/new 我
undefined method 'stores_path' for
在线上
遇到错误<%= form_for(@store) do |f| %>
这里有什么问题?谢谢(我已经有了存储控制器,所以如果我想使用脚手架,我必须为存储表重命名控制器)