I have 2 models: translation_file and translation_group, I upload files in translation_file and the data from those files I want to stock them in translation_group, I'm trying to use the after_create.
in my models/translation_file.rb:
class TranslationFile < ApplicationRecord
has_many_attached :yaml_files
after_create :file_to_data
def file_to_data
hash = YAML.load_file()#our file here
t = load_translation(hash)
#hash to translation_group
end
end
Does anyone knows a way to do it?
TranslationFileandTranslationGroupor do you want to stock the data in a new/existing instance ofTransitionGroup?after_createon the model?)