0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-15 14:22:53 +01:00

specify serializable attributes in field model

Dieser Commit ist enthalten in:
Faizaan Gagan 2021-05-17 01:21:55 +05:30
Ursprung 442f096940
Commit 4b559fb74e
2 geänderte Dateien mit 44 neuen und 38 gelöschten Zeilen

Datei anzeigen

@ -4,27 +4,27 @@ class CustomWizard::Field
include ActiveModel::SerializerSupport
def self.attributes
%i{
raw
id
index
type
step
required
value
description
image
key
validations
min_length
max_length
char_counter
file_types
format
limit
property
content
}
%i{
raw
id
index
type
step
required
value
description
image
key
validations
min_length
max_length
char_counter
file_types
format
limit
property
content
}
end
def self.accessible_attributes
@ -44,6 +44,28 @@ class CustomWizard::Field
attributes - accessible_attributes - excluded_attributes
end
def self.serializable_attributes
%i{
id
index
type
required
value
label
placeholder
description
image
file_types
format
limit
property
content
validations
max_length
char_counter
}
end
attr_reader *readonly_attributes
attr_accessor *accessible_attributes

Datei anzeigen

@ -8,23 +8,7 @@
##
class CustomWizard::FieldSerializer < ::ApplicationSerializer
attributes :id,
:index,
:type,
:required,
:value,
:label,
:placeholder,
:description,
:image,
:file_types,
:format,
:limit,
:property,
:content,
:validations,
:max_length,
:char_counter
attributes *CustomWizard::Field.serializable_attributes
def id
object.id