【发布时间】:2013-11-19 09:03:13
【问题描述】:
好的,我有一些问题要了解如何组织我的控制器。
我将使用一个简单的示例:我想创建一辆需要颜色、电机和车轮的汽车。 我需要每个选项的不同视图。
组织控制器的最佳方法是什么。
class CarsController < ApplicationControler
def select_wheels
#some code
end
def select_colors
#some code
end
def select_motors
#some code
end
##CRUD methods of Cars : index, new, create, show, edit, update, destroy
end
我正在寻找最佳实践。 谢谢你,对不起我的英语不好。
欧宾
【问题讨论】:
-
我是否需要为每个选项选择创建不同的控制器?
-
你有马达,车轮作为模型吗?您是否将它们与汽车相关联?那么你应该有单独的控制器
标签: ruby-on-rails architecture