nice-ambulance-76519
05/10/2023, 4:58 PMclass Quiz < ApplicationRecord
has_prefix_id :q, minimum_length: 6
belongs_to :blog
belongs_to :operation
has_many :questions
has_many :answers, through: :questions
has_and_belongs_to_many :email_accounts
has_one_attached :rules
.....
end
The action is not yet implemented and I'm just using to learn how it works before I can create a real one:
class CopyQuiz < Avo::BaseAction
self.name = "Make a copy"
def handle(**args)
models, fields, current_user, resource = args.values_at(:models, :fields, :current_user, :resource)
binding.pry
end
end
When I run the action, I get the following error that's shown in the screenshot.
If I remove the has_prefixed_ids it works fine.
Does any of you know if this is a problem on the avo side or on the prefixed_ids gem?loud-jewelry-99127
05/10/2023, 6:18 PMruby
self.find_record_method = ->(model_class:, id:, params:) do
if id.is_a?(Array)
model_class.where(id: id)
else
model_class.find(id)
end
end
nice-ambulance-76519
05/10/2023, 8:41 PM