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:
We don't have a lot of research on this but basically we would like to browse and manipulate the database (and all the attribute accessors of an model) without need to configure each field individually.
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: