purple-analyst-91381
07/03/2024, 1:55 PMbroad-helmet-78129
07/03/2024, 8:07 PM:belongs_to, but I'd like to display a field that is more meaningful than the object id (namely the :description field of the associated resource)purple-park-97233
08/18/2024, 6:36 PMpurple-park-97233
08/19/2024, 9:00 PMattach_fields, is there anything special I need to add to my model or controller somewhere?
I have the following "Company" field:
tab "Companies" do
field :companies, as: :has_many, through: :coaster_companyables,
attach_scope: -> { query.order(name: :asc) },
searchable: true,
show_on: :edit,
linkable: true,
attach_fields: -> {
field :role, as: :text
}
# field :companyables, as: :has_many
end
And when i try to attach a company and type a Role in, I just get Avo stating "Failed to attach Company".
No errors in the log, just this line:
rocessing by Avo::AssociationsController#create as TURBO_STREAM
20:58:39 web.1 | Parameters: {"authenticity_token"=>"[FILTERED]", "fields"=>{"related_id"=>"intamin-amusements", "role"=>"trains"}, "button"=>"", "view"=>"show", "resource_name"=>"attractions", "id"=>"this-one-at-this-place", "related_name"=>"companies"}
Just wondered if i'm missing something before I spin up a demo app.boundless-printer-62821
08/20/2024, 3:58 PMpurple-park-97233
09/14/2024, 10:33 AMpurple-park-97233
10/04/2024, 4:07 PMbelongs_to and not `select`s.
I'd appreciate a bit of help with getting this up and running and i've been scrabbling for days on this. Sighmammoth-guitar-49791
10/08/2024, 10:22 AM:has_one relationship suppose to trigger scope? In the documentation has_many relationships are not suppose to trigger a scope through association, only index.
https://docs.avohq.io/3.0/authorization.html#associations
shouldn't the behavior be the same for has_one?
https://cdn.discordapp.com/attachments/1141725718364045394/1293156682368553021/image.png?ex=67065982&is=67050802&hm=d5a4c19377850d3d5062d60621351eb65357d62470933929e67ef0029a10374e&helpful-waitress-4127
12/16/2024, 6:53 PMclass Avo::Resources::Listing < Avo::BaseResource
# self.includes = []
# self.attachments = []
self.search = {
query: -> { query.ransack(name_cont: params[:q], description_cont: params[:q], m: "or").result(distinct: false) }
}
self.title = :description
def fields
field :id, as: :id
field :name, as: :text
field :occ_macro_major, as: :belongs_to, searchable: true
field :occ_field_of_study, as: :belongs_to, searchable: true
end
end
class OccMacroMajor < ApplicationRecord
has_many :occ_field_of_studies, inverse_of: :occ_macro_major, dependent: :destroy
has_many :listings, inverse_of: :occ_macro_major
end
class OccFieldOfStudy < ApplicationRecord
belongs_to :occ_macro_major, inverse_of: :occ_field_of_studies
has_many :listings, inverse_of: :occ_field_of_study
endable-needle-51274
12/17/2024, 8:36 PMhelpful-waitress-4127
12/18/2024, 10:39 PMminiature-optician-85831
01/14/2025, 10:20 PMminiature-optician-85831
01/14/2025, 10:52 PMquaint-pencil-2979
02/07/2025, 1:36 PMdef fields
field :id, as: :id
field :name, as: :text, name: "Nome", required: true
field :email, as: :text, required: true
field :password, as: :password, only: [:new, :edit]
field :role, as: :select, enum: ::User.roles, name: "Acesso a plataforma", default: "super_admin", readonly: true
endstraight-pager-31449
02/17/2025, 8:14 AMfield :foo, as: :has_many, scope: -> {
query.limit(3) # limit does not work
}
has_many :foo, -> { limit 3 } # limit does not workcalm-gold-48525
03/15/2025, 1:35 AMpurple-park-97233
03/25/2025, 8:44 PMaction Avo::Actions::MakeMainPhotoFor,
arguments: -> do
{
attractions: record.attractions.pluck(:id)
}
end
but in the fields method I try to output that and I get the id of a record from a totally different class.
Any ideas?best-waiter-90128
09/17/2025, 2:27 PMindex_field_wrapper where custom ERB content gets ignored when the underlying field value is blank. The render_dash? method checks @field.value.blank? rather than whether custom content was provided, so users' ERB blocks execute (?) but their output is discarded in favor of showing "—".
It creates a confusing UX where providing custom content doesn't work unless you remember to add dash_if_blank: false. The option name dash_if_blank is also misleading - it sounds like it only controls dash display, but it actually determines whether custom content renders at all. It took me quite a while to figure out why my custom field wasn't rendering, and even then only discovered the fix by analyzing your implementation.
The issue also masks errors since the ERB runs but never renders, so you don't get feedback when your custom code has problems.
Would you consider checking if custom content exists before falling back to blank detection? Something like:
def render_dash?
return false if content.present?
if @field.type == "boolean"
@field.value.nil?
else
@field.value.blank? && @dash_if_blank
end
end
Something like that would respect user intent when they provide custom rendering while preserving the current behavior for standard field display.purple-park-97233
09/23/2025, 11:24 AMmagnificent-jackal-1244
09/24/2025, 2:56 PMglamorous-napkin-23111
10/01/2025, 12:53 PMdefault option on the field and set it using a Money object but it doesn't work. The form only displays 0.00 in the field. I've also tried setting the default value with the _cents field or with a static value such as 1000.00. Nothing works, the value loaded in the form is always 0.00.
This is the code:
field :labor, as: :money, currencies: [ "EUR" ], name: "Labor", required: true, default: project&.default_phase_labor
Any idea what is wrong here? Thanks for the support!nice-ambulance-76519
10/28/2025, 1:10 PMclass Avo::Resources::GamAccount < Avo::BaseResource
self.title = :name
self.includes = [:mcm, :currency]
def fields
field :id, as: :id
field :name, as: :text, filterable: true
field :network_code, as: :text, required: true
field :account_type, as: :select, enum: GamAccount.account_types
field :currency, as: :belongs_to, can_create: false
field :mcm, as: :belongs_to, can_create: false
field :status, as: :select, enum: GamAccount.statuses
field :utm_campaign_key_id, as: :text
field :channel_custom_dimension_key_id, as: :text
field :blogs, as: :has_many, can_create: false
field :gam_account_shares, as: :has_many
end
def actions
action Avo::Actions::GamAccountImportKeyValueMetrics
end
end
I do have ransackable_attributes defined on my model
def self.ransackable_attributes(auth_object = nil)
["name"]
end
But I'm getting the error
undefined method 'avo_dynamic_filters' for an instance of #<Class:0x00007fbbb6bdad20>miniature-optician-85831
10/28/2025, 1:10 PMminiature-optician-85831
10/28/2025, 1:11 PMmagnificent-jackal-1244
12/02/2025, 9:46 AMresource = Avo.resource_manager.get_resource_by_model_class(@reflection.active_record.name).new(params: helpers.params, view: view, user: helpers._current_user)
undefined method 'new' for nil
thanks!purple-park-97233
01/25/2026, 2:37 PMpurple-park-97233
02/27/2026, 11:06 AMlittle-article-64926
03/04/2026, 8:48 PMwide-waiter-22763
07/07/2026, 1:57 PMcccc, which should give the day of the week like Wednesday, this is not translated into my locale, but will always be english...
3. I could work around this by using format_display_using, but this does not seem to exist for this field type?
4. I wonder if we could have an option to disable flatpickr on desktop, too, as I'd prefer the native date pickers there (native datetime pickers are another story, firefox still only has a very basic one, but the date pickers are all right). They are also more accessible and work natively when testing with capybara.wide-waiter-22763
07/24/2026, 10:04 AMfield :city, as: :text, html: { show: { content: { classes: "my-test-class", style: "background: red; text: white;" } } }
This applies the class, but not the style. Looking at https://github.com/avo-hq/avo/blob/main/app/components/avo/field_wrapper_component.html.erb, I can see that style, data and classes are applied on lines 3-5 for the wrapper component, and the classes and data being applied for the content on lines 22 and 23 - but it seems like the style was simply forgotten there? 😅 (Same for the label)
Besides that, is there an easy way to make the preview image for a file field smaller? E.g. 512px squared, currently it takes up all available space 😄