You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some users would like to get all or some fields automatically from it's model class.
We can check the model attributes and foreign keys similar to how we discover them in the resource generator.
Current workarounds
Declare them manually as fields or build your own method.
Possible API
Note
Naming is TBD
# == Schema Information## Table name: users## id :bigint not null, primary key# name :string# age :string# is_admin :integer# created_at :datetime not null# updated_at :datetime not nullclassUser < ApplicationRecordend# beforeclassAvo::Resources::User < Avo::BaseResourcedeffieldsfield:id,as: :idfield:name,as: :textfield:age,as: :numberfield:is_admin,as: :booleanfield:created_at,as: :date_timefield:comments,as: :has_manyendend# afterclassAvo::Resources::User < Avo::BaseResourcedeffields# adds fields for all attributesdiscover_fields# selectively pick fieldsdiscover_fieldsonly_attributes: [:id,:name]discover_fieldsexcept_attributes: [:age]# associations discover_associationsendend
The text was updated successfully, but these errors were encountered:
Feature
Some users would like to get all or some fields automatically from it's model class.
We can check the model attributes and foreign keys similar to how we discover them in the resource generator.
Current workarounds
Declare them manually as
field
s or build your own method.Possible API
Note
Naming is TBD
The text was updated successfully, but these errors were encountered: