【发布时间】:2023-03-11 18:24:01
【问题描述】:
我是 Rails 的新手(以及 Web 开发 [但不是 Ruby 的新手]),但我仍然对约定很熟悉,更不用说 MVC。
我有一组(简化的)模型如下,为清楚起见排除了 belongs_to 关联:
Contact (has_many :accounts)
Account (has_many :service_1s, has_many :service_2s)
Service1 (has_many :service_1_usage_records)
Service1UsageRecords (has_many :service_1_usage_records_historical)
Service1UsageRecordsHistorical ()
Service2 (has_many :service_2_usage_records)
Service2UsageRecords ()
我需要从 Web 界面访问联系人、帐户、服务 1 和服务 2 的 REST 操作。其他模型用于后端。 这是否意味着,在这种情况下,我需要四个控制器来处理我需要的四组 REST 操作?
【问题讨论】:
标签: ruby-on-rails model-view-controller