https://avo.cool logo
Join Discord
Powered by
# resources
  • @Adrian from Avo Great work on the latest relea...
    m

    miniature-optician-85831

    03/13/2024, 9:51 PM
    Thread automatically created by rctneil in #1141725701549072486
    f
    l
    +3
    • 6
    • 61
  • I've noticed that in the global search, one of ...
    m

    miniature-optician-85831

    03/30/2024, 10:37 AM
    Thread automatically created by pmackay in #1141725701549072486
    l
    e
    • 3
    • 8
  • New Here, I have a Branch model, a Service mod...
    m

    miniature-optician-85831

    04/03/2024, 1:56 PM
    Thread automatically created by Hassan in #1141725701549072486
    l
    i
    • 3
    • 45
  • Is there any docs on how to get dashboards to w...
    f

    future-garden-51299

    04/05/2024, 7:57 PM
    Is there any docs on how to get dashboards to work within resources index and resource detail pages? I see the dashy stuff for a standalone dashboard, but in the Avo 3 release video there's a comment about being able to add them to the index and show views for a resource. Thanks!
    m
    l
    • 3
    • 6
  • hi guys - what is the recommended way to displa...
    m

    miniature-optician-85831

    04/23/2024, 8:27 AM
    Thread automatically created by RomanK in #1141725701549072486
    m
    l
    • 3
    • 2
  • Hi, I'm not fully understanding this on the doc...
    m

    miniature-optician-85831

    04/27/2024, 10:02 PM
    Thread automatically created by YorSant#83 in #1141725701549072486
    l
    s
    l
    • 4
    • 8
  • Hi again team! :avo: I'm facing a UX related '...
    q

    quiet-magazine-86193

    05/01/2024, 5:08 PM
    Hi again team! I'm facing a UX related 'issue'. When actions are listed on the dropdown, they are disabled/greyed if the action isn't standalone AND if we have not selected records from the checkboxes. Awesome, all good, prevent us from running the action with no records selected. Is it possible to replicate this feature somehow when we copy the actions directly into the
    index_controls
    ? It is a bad UX to the action needed to load and run, to then, display them a
    No records selected
    error. Without mentioning they will need to write/select/whatever from the action-fields.
    m
    l
    • 3
    • 4
  • Hi again again! Did anyone face this issue befo...
    q

    quiet-magazine-86193

    05/10/2024, 7:29 PM
    Hi again again! Did anyone face this issue before? I'm not able to find any patron of settings on our end who can cause it. We randomly see some of the
    row_controls
    hidden, on different resources: https://cdn.discordapp.com/attachments/1141725701549072486/1238573624714330204/image.png?ex=663fc713&is=663e7593&hm=3b30d863226d22765496122a0836273f1a598dc56f9291bdd0884e5e7365af5f& https://cdn.discordapp.com/attachments/1141725701549072486/1238573625020383305/image.png?ex=663fc713&is=663e7593&hm=1c3d108e9a7f2382242fecee7897200f9b756a1c438a1514b9ebe214216006a6&
    m
    l
    • 3
    • 10
  • Hi, I need to use a helper in a Resource. I f...
    p

    purple-park-97233

    05/12/2024, 12:31 PM
    Hi, I need to use a helper in a Resource. I follwed the docs and added this to the end of avo.rb but my app fails to start: module FieldExtensions # Include a specific helper include AttractionHelper end
    Copy code
    Rails.configuration.to_prepare do
        Avo::Fields::BaseField.include FieldExtensions
    end
    Copy code
    Exiting
    13:30:45 web.1    | /Users/neiltonge/Developer/neiltongesite/config/initializers/avo.rb:171:in `<module:FieldExtensions>': uninitialized constant FieldExtensions::AttractionHelper (NameError)
    13:30:45 web.1    |
    13:30:45 web.1    |     include AttractionHelper
    13:30:45 web.1    |             ^^^^^^^^^^^^^^^^
    13:30:45 web.1    |     from /Users/neiltonge/Developer/neiltongesite/config/initializers/avo.rb:169:in `<main>'
    m
    l
    • 3
    • 7
  • try `::AttractionHelper`
    m

    miniature-optician-85831

    05/13/2024, 7:21 AM
    Thread automatically created by Paul Bob in #1141725701549072486
  • If I have a has many through. What is the best ...
    p

    purple-park-97233

    05/15/2024, 6:33 AM
    If I have a has many through. What is the best way to add data into the through record?
    m
    l
    l
    • 4
    • 11
  • Hello fellow engineers, do you happen to know i...
    a

    agreeable-jelly-60158

    06/06/2024, 5:07 PM
    Hello fellow engineers, do you happen to know if there is a way to display a banner, warning, modal or red square, or actually any form of visual indication, in the edit view of a record when that record has a specific attribute set to true?
    m
    l
    • 3
    • 5
  • Is there a way to increase the number of result...
    p

    purple-park-97233

    06/22/2024, 11:33 AM
    Is there a way to increase the number of results when searching? I'm searching for a name of a record, but as there are quite a few, the one i'm after doesn't get returned.
    m
    l
    • 3
    • 4
  • how to hide edit button for has_one association...
    p

    proud-breakfast-80041

    07/04/2024, 11:48 AM
    how to hide edit button for has_one association ? example: user.rb has_one :book has_one :library, through: :book in user_policy def edit_library? false end doesnt work it seems that it only checks edit? in LibraryPolicy
    m
    l
    • 3
    • 4
  • Attach association errors
    p

    proud-breakfast-80041

    07/04/2024, 2:40 PM
    Hey , is it available to show errors messages during attach assocation ? example: user.rb has_many :teams has_many :friends, through: :teams in avo resource field :friends, as: :has_many, through: :teams if admin went to user page and click on attach friend and some error happend ( ActiveRecord::RecordInvalid) i want to be able to view the eror message as an admin , but nothing is shown
    m
    l
    • 3
    • 4
  • Hey i found an error while trying to create a r...
    p

    proud-breakfast-80041

    07/09/2024, 9:18 AM
    Hey i found an error while trying to create a related association , i've this models event has_many :teams, dependent: :destroy has_many :players, through: :teams team belongs_to :event has_many :players, dependent: :destroy player belongs_to :team has_one :event, through: :team` now when i try to create a player from event page the url has this
    via_relation=events
    when i click save player is saved, however there is an error in redirection in this method
    Copy code
    def after_create_path
          # If this is an associated record return to the association show page
          if is_associated_record?
            parent_resource = if params[:via_resource_class].present?
              Avo.resource_manager.get_resource(params[:via_resource_class])
            else
              Avo.resource_manager.get_resource_by_model_class(params[:via_relation_class])
            end
    
            association_name = BaseResource.valid_association_name(@record, params[:via_relation])
    
            return resource_view_path(
              record: @record.send(association_name),
              resource: parent_resource,
              resource_id: params[:via_record_id]
            )
          end
    as
    association_name
    returns nil , because` params[:via_relation]` is events but the association to the player is actually event
    m
    l
    • 3
    • 27
  • Hi! I'm having a "weird" issue with the reorder...
    n

    narrow-laptop-54609

    07/11/2024, 8:21 PM
    Hi! I'm having a "weird" issue with the reordering feature. I'm using act_as_list 1.2.1 and Avo 3.9.1 and locally it works fine, but on production it's doing something interesting where it doesn't seem to update the records affected. I'm showing the position number in the index table, so I end up for example with two position 10 or three position 11, is it cache related? https://cdn.discordapp.com/attachments/1141725701549072486/1261054704637706301/Screenshot_2024-07-11_at_3.20.34_PM.png?ex=66919036&is=66903eb6&hm=35f7e749e871ea28d2de8a752391f4f00db46e2d0ea3c2080507dbc494b3b14c&
    m
    l
    • 3
    • 15
  • Hey all - we're trying to check a permission wi...
    f

    future-garden-51299

    07/18/2024, 6:02 PM
    Hey all - we're trying to check a permission within a resource#display_fields method, and want to know if the pundit policy is available in this context, and if so, how would we access it?
    m
    l
    • 3
    • 33
  • Is there any easy way when using modules and th...
    m

    mammoth-guitar-49791

    07/27/2024, 11:38 AM
    Is there any easy way when using modules and the self.class_name argument for a resource to override the name that appears in the ago application sidebar?
    m
    l
    • 3
    • 2
  • Bit of an odd one: I have my two models: Attr...
    p

    purple-park-97233

    08/01/2024, 7:12 PM
    Bit of an odd one: I have my two models: Attraction belongs_to :venue Venue has_many :attractions This is great and Avo is managing them excellently. I use
    friendly_id
    and have set the index query to:
    Copy code
    self.find_record_method = -> {
            if id.is_a?(Array)
                query.where(slug: id)
            else
                query.friendly.find id
            end
        }
    This too works great. Each record has it's slug and in my app, the slug of an Attraction contains the name and another attribute of the Venue it is associated with. I have it all configured so that if the
    name
    or
    location_1
    values of the Venue get changed, then the slugs of the Attractions get updated too. I know slugs don't typically change but it is very useful in my case. If I make a change to a Venue that causes a new slug to be generated and I came from a standard Resource Index view (eg: http://localhost:3000/avo/resources/venues/drayton-manor-drayton-bassett) and edit it, it's fine, but if I get to the edit page and I have a URL like (http://localhost:3000/avo/resources/venues/drayton-manor-drayton-bassett?via_record_id=accelerator-drayton-manor-drayton-bassett&via_resource_class=Avo%3A%3AResources%3A%3AAttraction) When it tries to go back to the page in the
    via_record_id
    query param, it fails, because the slug is no different and the record can't be found. It all makes sense and I understand why it's occuring. My question is, what do you think? Are there any options to overcome this? Can you think of other ways to deal with this? I am considering adding a new field altogether which sort of replicates the nromal
    slug
    field but always stays in sync with the name, venue and location_1 values and just let the regular
    slug
    column act like that and once set, never change. Would that make more sense?
    m
    l
    • 3
    • 10
  • Any idea why I keep getting Unpermitted Paramet...
    p

    purple-park-97233

    08/05/2024, 5:32 PM
    Any idea why I keep getting Unpermitted Parameter errors? How should I permit them? Unpermitted parameters: :location_1, :location_2, :location_3, :country, :coordinates, :sort_letter, :notes, :website_url. Context: { controller: Avo::VenuesController, action: create, request: #, params: {"authenticity_token"=>"[FILTERED]", "venue"=>{"order_visited"=>"", "name"=>"sdd", "type"=>"theme_amusement_park", "slogan"=>"", "mascot"=>"", "location_1"=>"1", "location_2"=>"2", "location_3"=>"3", "country"=>"AF", "coordinates"=>{"lat"=>"1", "lng"=>"1"}, "sort_letter"=>"", "notes"=>"", "website_url"=>""}, "button"=>"", "controller"=>"avo/venues", "action"=>"create"} }
    m
    l
    l
    • 4
    • 43
  • Hey all, on resources its possible to define `d...
    b

    boundless-printer-62821

    08/09/2024, 3:36 PM
    Hey all, on resources its possible to define
    default_sort_column
    , but is it also possible to change the default sort order to asc (it defaults to descending otherwise)?
    m
    l
    • 3
    • 8
  • personal opinion: I think the `record_selector ...
    n

    narrow-electrician-89982

    09/11/2024, 6:59 PM
    personal opinion: I think the
    record_selector = false
    should be set by default instead of true, since there's no need to show the select field unless you have an action that does something to the selected records; which in 99% of the cases, no one has
    m
    l
    • 3
    • 8
  • Folks, how would you have a "Filter" but with a...
    b

    billowy-airline-65932

    09/20/2024, 6:00 PM
    Folks, how would you have a "Filter" but with a different type of the
    field
    that you need to display on the Index view? For example: I have a field as
    badge
    , but my filter for this field needs to be as :select. Any ideas on how I could have this config?
    m
    l
    • 3
    • 11
  • Does anyone have an example of a custom select ...
    b

    billowy-airline-65932

    10/03/2024, 7:04 PM
    Does anyone have an example of a custom select field with autocomplete search capabilities? Maybe I could use a lib instead of writing my own with stimulus?
    m
    l
    • 3
    • 2
  • Since there are many Card classes that we want ...
    s

    straight-pager-31449

    10/12/2024, 5:23 AM
    Since there are many Card classes that we want to use generically, is it possible to set the id as an argument? Avo 3.13.6, even if the id is specified within the query as shown below, the id becomes nil, causing an error. Up until Avo3.13.1, it was possible to set the id as an argument as shown below.
    Copy code
    class Avo::Cards::SumTotalNumber < Avo::Cards::PartialCard
      self.partial = 'avo/cards/sum_total_number'
    
      def query
        self.id = arguments[:id]
        ...
      end
    end
    Copy code
    def cards
        card Avo::Cards::SumTotalNumber, cols: 1, rows: 2,
             arguments: { id: :foobar, foo_data:, bar_statistics:...
      ...
    m
    l
    • 3
    • 25
  • is it possible to have resource name in upperca...
    h

    helpful-waitress-4127

    02/12/2025, 6:41 PM
    is it possible to have resource name in uppercase? for example "NOC codes" instead of "Noc codes"
    m
    f
    l
    • 4
    • 11
  • Hi there. This is not a complaint or concern, ...
    m

    miniature-optician-85831

    03/23/2025, 1:29 PM
    Thread automatically created by rctneil in #1141725701549072486
  • Hi, This is not a complaint or concern, merely ...
    p

    purple-park-97233

    03/23/2025, 1:37 PM
    Hi, This is not a complaint or concern, merely a question: I have models of Attraction, Company, Companyable. The associations are: Attraction:
    Copy code
    has_many :companyables, as: :companyable
        has_many :companies, -> { distinct }, through: :companyables
    Company:
    Copy code
    has_many :companyables
        has_many :attractions, through: :companyables, source: :companyable, source_type: 'Attraction'
        has_many :roles, -> { distinct }, through: :companyables
    Companyable:
    Copy code
    belongs_to :company
        belongs_to :companyable, polymorphic: true
        belongs_to :role, optional: true
        belongs_to :model, optional: true
        belongs_to :submodel, optional: true
    This works fine and on my Attraction resource I have:
    Copy code
    tab "Companies" do
                    field :companyables, as: :has_many
                end
    This works fine and allows me to add new companyables via the UI where I can select the Role, the Model, and the SubModel for it. This all makes sense to me, but looking at it from a User perspective, they have no idea what a "Companyable" is, it's a made up word that means absolutely nothing to them. To them they "want to add a Company to an Attraction", but technically what they need to do is "Add a Companyable to an Attraction" as the Companyable holds all the info about the role and the model/submodel. Do I leave everything as it is and try to explain to Users what it means or can you recommend changes that may make it more user friendly and user understandable? Changes could be as simple as altering wording. Could I change "Companyable" to "Company" just in the context of the UI? If I did that then the sidebar item for "Companyables" would be confusing. It's tricky. Technically it all works beautifully and i'm very happy with it. Right now I ahve no plans to roll this out to other people so it is a non issue but it is something i've been thinking of how I could overcome it if I was to roll it out to others in the future.
    m
    l
    • 3
    • 6
  • New Thread
    m

    miniature-optician-85831

    03/23/2025, 1:37 PM
    Thread automatically created by rctneil in #1141725701549072486