我正在构建一个应用程序来管理一些产品,所以我有一个产品模型。
我们销售,购买,当产品坏了,我们把它送到制造商那里修理。
所以,我已经创建了一个电影模型,它将照顾到产品的所有细节。
当我们购买一款产品时,在电影记录表中为每个产品生成一条输入记录。出售和维修。
我试图让它更多地休息,这就是为什么我感到困惑。
我怎么发动汽车呢?资源:影视化?或者我应该创建一个"product_in“和一个"product_out”控制器?
我想让urls类似于“电影/: to _where/:方向”(in/out),这样才能正确绘制视图。
有特制的吗?
发布于 2010-10-12 21:57:28
你可以有一个带有in/out操作和:to_where参数的movimentation_controller。因此,对于路由,您有两个选择:
#if you have other REST actions do this:
resources :movimentation do
member do
get :in
get :out
end
end
#or go with a match:
match '/movimentation/in/:to_where' => 'movimentation#in'
match '/movimentation/out/:to_where' => 'movimentation#out'干杯A。
https://stackoverflow.com/questions/3909551
复制相似问题