Skip to content

before_create not working, Is there any solution? #80

@RanX12

Description

@RanX12

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions