我正在建立一个在线商店,并认为最好为各种复合部件命名。产品、订单、用户等...
我目前已定义和布局如下的产品模块
Product::Base 基础产品本身,它定义了尺寸、类型和可用颜色
Product::Type 高级产品分类
Product::Colour HABTM 颜色与 Base 的关系
Product::Unit 根据不同的数量和运费进行扩展
现在我的问题与控制器和路由有关。我希望模块显示为资源,并将其中一个模型(基础)作为“头部”。我已经设法让这个工作
  scope :module => "product" do
    resources :base, path: "product"
  end
从 rake 路线产生
  base_index GET    /product(.:format)          product/base#index
           POST   /product(.:format)          product/base#create
  new_base GET    /product/new(.:format)      product/base#new
 edit_base GET    /product/:id/edit(.:format) product/base#edit
      base GET    /product/:id(.:format)      product/base#show
           PUT    /product/:id(.:format)      product/base#update
           DELETE /product/:id(.:format)      product/base#destroy
这正是我想要的行为,但我的问题是,这种方法是 RESTful 且正确的吗?我宁愿现在被告知我错了,也不愿再往下走。
一如既往的感谢。