0
votes

I have two models sessions and speakers, I need to add multiple speakers to sessions. for that am using has_many belongs_to association

my models are

class Speakers < ActiveRecord::Base has_many :sessions end

class Sessions < ActiveRecord::Base belongs_to :speakers end

I am using activeadmin for this project, how to add multiple ids to speakers_id column in sessions table via check_boxes in activeadmin.

thanks

1

1 Answers

0
votes

For this goal I wouldn't use has_many association. The best solution would be to use has_many through and join table.

That would save you time.

Otherwise you will have to write code for recording comma separated values in one column, since this is not common logic for formtastic. That is also might cost you problems during update action.