bulk_insert icon indicating copy to clipboard operation
bulk_insert copied to clipboard

before_create not working, Is there any solution?

Open RanX12 opened this issue 3 years ago • 0 comments

rails: 6.0 ruby: 2.7.2 bulk_insert: 1.8.1

used

WrittenPadQuestion.bulk_insert(.....) do |worker|
   .....
   .....
   .....
end

app/models/questions.rb

xxxxs.rb:

belongs_to :original_question, optional: true

has_many :question_tag_relations, dependent: :destroy
has_many :tags, through: :question_tag_relations

before_create :setup_tags

private

def setup_tags
  self.tag_ids = original_question.tag_ids
end

before_create not working, Is there any solution?

RanX12 avatar Apr 10 '21 04:04 RanX12