如何在Post中添加下拉列表?
如何在Post的新页面中添加所有可能类别的下拉列表?
这是当前的设置(由于在线各种教程的拼凑,这是非常零碎的)。 如果有更多信息我应该添加,请告诉我。 谢谢。
发布模型
class Post :categorizations has_many :comments, as: :commentable end
分类模型
class Category :cateogorizations end
分类模型
class Categorization < ActiveRecord::Base belongs_to :post belongs_to :category end
发布_form.html.erb
prohibited this post from being saved:
分类_form.html.erb
prohibited this categorization from being saved:
编辑
我能用这条线以Post的forms显示它:
true } )%>
实际上,迷你秒更新,我把它改成了这一行:
因为我想要一个下拉列表本身,而不是一个集合列表。
好极了! 如何让它显示在Post的显示页面中?