Is there a way for us to display columns
# avo-2
a
Is there a way for us to display columns in the index view of a resource from an associated model, or does it have to be defined as an attribute on the resourced model?
i.e. if I have
user belongs_to :company
can the resource display
user.company.name
or do I need to define a
def company_name
on the user itself?
l
you can: 1. do what you suggested and add a getter to that model 2. use a computed field
Copy code
ruby
field :company_name, as: :text do
  record.company.name
end
# don't forget to eager load the company
self.includes = [:company]
FYI, computed fields only show up on
Index
and
Show
views
a
oh that's great. thanks.