title: Rails ActiveAdmin form for many-to-many relationship through a join table not working
body: <p>I have in my Rails application BlogPosts and BlogCategories, and a BlogPostCategorization table to join them together. So </p>
  
  <pre><code>class BlogCategory &lt; ActiveRecord::Base
    attr_accessible :name, :created_at, :updated_at, :blog_post_id
    validates :name, presence: true, uniqueness: true
    has_many :blog_post_categorizations
    has_many :blog_posts, :through =&gt; :blog_post_categorizations
    accepts_nested_attributes_for :blog_posts, allow_destroy: true
  end
  class BlogPost &lt; ActiveRecord::Base
  
    attr_accessible :body, :created_at, :updated_at, :image_url, :title
    validates :body, :image_url, :title, presence: true
    validates :title, uniqueness: true
    has_many :blog_post_categorizations
    has_many :blog_categories, :through =&gt; :blog_post_categorizations
    accepts_nested_attributes_for :blog_categories, allow_destroy: true
  end
  class BlogPostCategorization &lt; ActiveRecord::Base
    belongs_to :blog_post
    belongs_to :blog_category
  end
  </code></pre>
  
  <p>Now through ActiveAdmin, I want to be able to create a new blog post, and create categories for this blog post. I have </p>
  
  <pre><code>form do |f|
      f.semantic_errors *f.object.errors.keys
      f.inputs "Blog Post" do
        f.input :title
        f.input :body, as: :html_editor
        f.input :image_url
      end
      f.inputs "Blog Categories" do
        f.has_many :blog_post_categorizations do |s|
          s.input :blog_category
        end
      end
      f.actions
  end
  </code></pre>
  
  <p>But when I try to access the active admin page for new Blog Post, I get a rails error message saying "undefined method `new_record?' for nil:NilClass" on the line where</p>
  
  <p>f.has_many :blog_post_categorizations do |s|</p>
  
  <p>What am I doing wrong/missing?</p>
  
  <p>Additionally, included below is the blog_category data that's being sent in the params hash of the POST request</p>
  
  <pre><code>"blog_categories_attributes"=&gt;{"1408936652467"=&gt;{"name"=&gt;"cooking"}, "1408936656066"=&gt;{"name"=&gt;"eat"}}
  </code></pre>