我正在构建一个Api,可以在其中使用Audited gem (在经过审核的行为之前)在模型上注册更改,对于JSON响应,我也使用{ {3}}宝石
一切正常:
AuditSerializer.new(Audit.all)
因此,当我使用(如fast_jsonapi)构建JSON响应时:
AuditSerializer.new(Audit.all).serialized_json
说以下错误
ArgumentError: wrong number of arguments (given 0, expected 1)
class Audit < Audited::Audit
end
class AuditSerializer
include FastJsonapi::ObjectSerializer
attributes :auditable_id, :auditable_type, :associated_id, :associated_type, :user_id, :user_type, :username, :update, :audited_changes, :version, :comment, :remote_address, :request_uuid, :created_at
end
Audited.config do |config|
config.audit_class = Audit
end