bland-terabyte-47512
07/10/2023, 10:07 AMclass CommonResource < Avo::BaseResource
field :common_field, as: :text do
logic
end
end
and then 3 other resources that inherit from that one.
So returning to the question, I am supposed to use avo in this way? Is there other alternatives for this?lemon-wall-20836
07/10/2023, 10:08 AMlemon-wall-20836
07/10/2023, 10:08 AMbland-terabyte-47512
07/10/2023, 10:09 AMlemon-wall-20836
07/10/2023, 10:09 AMbland-terabyte-47512
07/10/2023, 10:09 AMbland-terabyte-47512
07/10/2023, 10:09 AMbland-terabyte-47512
07/10/2023, 10:09 AMbland-terabyte-47512
07/10/2023, 10:09 AMlemon-wall-20836
07/10/2023, 10:09 AMlemon-wall-20836
07/10/2023, 10:09 AMbland-terabyte-47512
07/10/2023, 10:10 AMlemon-wall-20836
07/10/2023, 10:10 AMdef fields
method and the composability will be improvedbland-terabyte-47512
07/10/2023, 10:11 AMbland-terabyte-47512
07/10/2023, 10:11 AMlemon-wall-20836
07/10/2023, 10:11 AMlemon-wall-20836
07/10/2023, 10:13 AMruby
module SomeModule
def self.common_fields
-> {
field :common_field, as: :text do
logic
end
}
end
end
class UserResource < Avo::BaseResource
field :one
SomeModule.common_fields.call
field :two
end
class PersonResource < Avo::BaseResource
field :four
SomeModule.common_fields.call
field :five
end
lemon-wall-20836
07/10/2023, 10:13 AM