ActiveAdmin paginate表单输入has_many

时间:2017-11-07 10:18:03

标签: ruby-on-rails ruby-on-rails-4 pagination activeadmin formtastic

我有这样的事情:

class Actor < ActiveRecord::Base

  attr_accessible :name, :actor_movie_relationships_attributes

  validates :name

  has_many :actor_movie_relationships, autosave: true
  has_many :movies, through: :actor_movie_relationships

  accepts_nested_attributes_for :actor_movie_relationships

end

class ActorMovieRelationship < ActiveRecord::Base

  belongs_to :movie
  belongs_to :actor

  validates :movie, :actor, presence: true

end

由于Actor可以有很多电影,我想分页用于管理这些关系的ActiveAdmin表单。

目前我有这个表格(没有分页):

form do |f|
  tabs do
    tab 'Actor' do
      f.inputs 'Basic Information' do
        f.semantic_errors *f.object.errors.keys
        f.input :name
        f.input :deleted
      end
    end
    tab 'Movies' do
      f.inputs 'List of movies' do
        f.has_many :actor_movie_relationships, heading: '', new_record: 'Add a Movie', allow_destroy: true  do |a|
          a.input :Movie, collection: Movie.dropdown_names_map.call
        end
      end
    end
  end

  f.actions
end

知道如何以这种形式向Movies添加分页吗?

0 个答案:

没有答案