I might be missing something fundamental here, but I can't get ActiveAdmin to work with sorting has_many through relationships, with the ability to create new entries.
So, given the following models
class User < ActiveRecord::Base has_many :user_videos has_many :videos, through: :user_videos accepts_nested_attributes_for :user_videos accepts_nested_attributes_for :videos ... end class UserVideo < ActiveRecord::Base belongs_to :user belongs_to :video accepts_nested_attributes_for :video end class Video < ActiveRecord::Base has_many :user_videos has_many :users, through: :user_videos ... end
(I admit that I am throwing accepts_nested_attributes_for around in the hope that something might work)
And setting up Active Admin goes something like this (WIP, of course):
f.inputs "User" do f.has_many :user_videos, heading: 'Videos', sortable: :order, allow_destroy: true, new_record: 'New Record' do |v| v.inputs for: :video do |video| video.input :video_url end end f.has_many :videos, heading: 'Videos', new_record: 'New Video' do |v| v.input :video_url end end f.actions
The first has_many in the association :user_videos does not represent any inputs. If there are entries there, I can see that video.input :video_url actually returns the li tag with label and input , however nothing is displayed on the page. For new entries, the entire v.inputs bit v.inputs not start (do I need to create child entries first?).
The second has_many will work so that you can add records and update existing records, but they cannot be sorted, since the order column is in the UserVideos model. I include this more as an illustration than anything.
If anyone has any pointers to this, they will be very grateful. :)