Question

I am customizing RailsAdmin for one of my project. I am trying to achieve multi select box like below for many to many association

enter image description here

My Class are different (No Teams) , I have tour and programs

Tour Class

class Tour < ActiveRecord::Base
  attr_accessible :name

  has_and_belongs_to_many :programs
end

Program Class

class Program < ActiveRecord::Base
  attr_accessible :name

  has_and_belongs_to_many :tours
end

Joint Table

class ProgramsTours < ActiveRecord::Migration
  def change 
    create_table :programs_tours, :id => false do |t|
      t.integer :program_id
      t.integer :tour_id
    end
  end
end

This association creating an Multiple Add form with tabs as below , I am not sure how I can get that multi select box, any suggestions will be helpful.

enter image description here

Was it helpful?

Solution

class Tour < ActiveRecord::Base

   attr_accessible :name, :program_ids

   has_and_belongs_to_many :programs

end


class Program < ActiveRecord::Base

   attr_accessible :name, :tour_ids

   has_and_belongs_to_many :tours

end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top