http://www.youtube.com/watch?v=PUHmX18Zmyk動画でブログを作っています。私の投稿モデルは
class Post < ActiveRecord::Base
attr_accessible :body, :publish_date, :title, :user_id
validates_presence_of :title, :body, :publish_date, :user_id
belongs_to :user
has_and_belongs_to_many :categories
end
カテゴリーモデルは
class Category < ActiveRecord::Base
attr_accessible :name
validates_presence_of :name
has_and_belongs_to_many :posts
end
ビデオでは、彼はそのようなコードを使用して、新しい投稿でカテゴリのリストを生成しました
<% f.association :categories, :as => :checkboxes %>
しかし、私はエラーがあります
undefined method `association' for #<ActionView::Helpers::FormBuilder:0xb5e82b40>
カテゴリのリストを作成する正しい方法は何ですか?