Insert Bulk data using active record import
Imagine a scenario where you have to create a report and send it to multiple clients, so lets just say you have a report model and you have client and you have report client model. lets first check all the association and model structure. #report model class Report < ActiveRecord::Base has_many :report_clients has_many :clients, through: :report_clients end #report_client class ReportClient < ActiveRecord::Base belongs_to :report belongs_to :client end #clients class Client < ActiveRecord::Base has_many :report_clients has_many :reports, through: :report_clients end No lets say you want to create a report for 30 clients. You can do that by adding nested attributes in rails. so our report model will became class Report < ActiveRecord::Base has_many :report_clients has_many :clients, through: :report_clients accepts_nested_attributes_for :report_...