Rails 4 collection_select 是否违反了 MVC?

Rails 4 collection_select is MVC violated?

我有一个关于 Rails 4 中 collection_select 的小问题。 当我们调用 collection_select 中的所有元素时 table 示例:

<%= f.collection_select :category_id, Category.all, :id, :name %>

是否违反了MVC? 换句话说:如果我在产品视图中有一个 collection_select 并在此视图中调用 Category.all,对我来说,我们违反了 MVC 模式。因为 Category.all 是模型中应该有的东西。

如果我说得对,请告诉我。

将集合作为选项列表传递给 collection_select 并不违反 MVC 模式,这只是 collection_select 植入数据的方式。