https://avo.cool logo
Join Discord
Powered by
# avo-2
  • r

    ripe-article-50191

    03/06/2023, 10:48 AM
    How can access to the instantiated model inside an AVO resource?
    l
    • 2
    • 8
  • n

    nice-ambulance-76519

    03/06/2023, 3:50 PM
    Hi, I'm doing a trial on Avo 2.27 and I have 2 models (Quiz and EmailAccounts) which have a :has_and_belongs_to_many association. In the docs I've found a warning saying that I cannot create a new Email Account from the quiz show page(At least that's how I understood). Would it be possible to remove the button "Create new Email account" and leave only the "Attach email account" available for users?
    l
    • 2
    • 12
  • k

    kind-jewelry-65180

    03/07/2023, 11:26 AM
    Hello! Im having an issue during assets:precompile because im calling this code :
    Model.pluck(:name, :id)
    inside the resource to generate the options for a select, and this is giving an error on docker build in production. How can i create this list without call the model inside the resource?
    l
    c
    • 3
    • 21
  • k

    kind-jewelry-65180

    03/07/2023, 11:28 AM
  • m

    melodic-toddler-97877

    03/07/2023, 3:44 PM
    I have a searchable
    :belongs_to
    field on a form that loads a list of users. To render the user's name in the dropdown, we have to include an associated table with their name. Is there a way to specify that I wan't that data to be included? I'm getting n+1s when the list of users attempts to load.
    l
    • 2
    • 7
  • r

    ripe-article-50191

    03/08/2023, 4:32 PM
    I have a tag selector, but the array of suggestions return thousands of records, can I use stimulus to find the records instead preload all the suggestions?
    l
    • 2
    • 26
  • q

    quiet-winter-98496

    03/08/2023, 6:14 PM
    Is there a way to show a badge on the grid index view? I'd love to be able to show a badge in the corner of each grid item so I can quickly see the state of each resource. It's possible on the table view but not the grid I think?
    l
    • 2
    • 6
  • s

    straight-mechanic-78430

    03/09/2023, 1:39 PM
    I need to restyle the profile menu , we would like to have the profile menu on the top navigation on the right side . Has anyone already done a such task ? any ideas or Hint where to start are highly appreciated .
    l
    • 2
    • 4
  • s

    straight-mechanic-78430

    03/09/2023, 1:40 PM
    @lemon-wall-20836 Get the champagne ready to pop at 1K πŸ™‚ where should i join hihi πŸ₯‚
  • l

    lemon-wall-20836

    03/09/2023, 1:49 PM
    haha. I will! 1K is a milestone. thank you!
  • l

    lemon-wall-20836

    03/10/2023, 10:13 AM
    Does anyone have experience with Algolia crawler and could lend me 10 minutes of their time? I'd like to improve the search on http://docs.avohq.io
  • l

    lemon-spoon-80671

    03/10/2023, 12:17 PM
    hi all I am working on authorizations and making use of what is described here: https://docs.avohq.io/2.0/authorization.html#policies and it works perfectly. Now, I have this case where I am blocked: I have a model "session_execution.rb", which
    Copy code
    belongs_to :session
    has_many :session_execution_attendances
    has_many :farmers, through: :session_execution_attendances
    and I would like to hide the "Create new farmer" button in the "session execution" show. In my "session_execution_policy.rb" I have tried this:
    Copy code
    def create_session_farmers?
        false
      end
    but without success. Could it be that I am missing something because of the has_many through relation? Thanks.
    l
    • 2
    • 8
  • l

    little-psychiatrist-30020

    03/13/2023, 10:45 AM
    Hi. Quick question, if I have a
    belongs_to
    relationship that has 60K+ records, how can I tell avo not to try and load all of them but only do a search?
    l
    • 2
    • 21
  • l

    little-psychiatrist-30020

    03/13/2023, 10:46 AM
    Artist Load (52.1ms)  SELECT "artists".* FROM "artists"
  • l

    little-psychiatrist-30020

    03/13/2023, 10:46 AM
    I didn't see anything about this on the belongs_to page in the docs, so I'm wondering how to avoid loading all these records.
  • r

    ripe-article-50191

    03/14/2023, 9:23 AM
    Using
    after_create_path
    in AVO controller end in error "Render and/or redirect were called multiple times in this action"
    l
    • 2
    • 2
  • l

    little-psychiatrist-30020

    03/14/2023, 9:30 AM
    I have another quick question, if I have an active storage
    has_many_attached :images
    association, how could I go about showing a preview of the first one? Eg it doesn't work the same as a singular file. I tried using a computed field but it didn't like that.
    l
    • 2
    • 9
  • l

    little-psychiatrist-30020

    03/14/2023, 9:30 AM
    Copy code
    field 'cover', as: :file, link_to_resource: true, only_on: :index do |model|
        model.images.first
      end
  • l

    little-psychiatrist-30020

    03/14/2023, 11:53 AM
    Hello again! One more question, how can I either enable the search to return more than 8 results? Or somehow get the rest of those that are hidden, eg if I do a search containing 18 results and seemingly can't narrow the search further by typing more, how can I get all of these 18?
    l
    • 2
    • 18
  • a

    able-needle-51274

    03/14/2023, 8:17 PM
    can we do an
    as: :has_many
    where the foreign key is not the expected value?
    l
    • 2
    • 7
  • a

    able-needle-51274

    03/14/2023, 8:17 PM
    for example, if the model is User but the foreign key is
    participant_id
    instead of
    user_id
    ?
  • b

    bright-tomato-27372

    03/15/2023, 9:22 PM
    has anyone removed the link to a resource for a
    belongs_to
    ? I don't see an option for it in the docs. Example: I'm on the index page of `Comment`s and I show the
    belongs_to
    association to a
    Post
    . I want to remove the link to the
    Post
    record because it is unnecessary and I want to simplify some UI interactions. Passing a
    link_to_resource: false
    does not work since it is limited to only
    Id
    ,
    Text
    , and
    Gravatar
    . any reason why we don't extend that to associations? or does anyone have a suggestion of a quick fix / patch for that?
  • p

    powerful-planet-46063

    03/15/2023, 10:14 PM
    As far as a quick fix/patch I suggest to just set it as a computed text field for the views you don't want a link.
    Copy code
    ruby
        field :item,
              as: :belongs_to,
              only_on: [:forms]
        field :item,
              as: :text,
              hidden_on: [:forms] do |model, resource, view|
          model.item.label_maybe
        rescue StandardError
          false
        end
  • b

    bright-tomato-27372

    03/15/2023, 10:37 PM
    gah, don't know why I didn't think to do that sooner with this one when I do it in other fields I have (aren't belongs_to though so I didn't relate it) 🀣 thanks @powerful-planet-46063!!
  • p

    powerful-planet-46063

    03/16/2023, 12:21 AM
    hah it happens! You bet!
  • l

    lemon-wall-20836

    03/16/2023, 10:22 AM
    the perfect response πŸ‘†that's what I'd do
  • l

    lemon-wall-20836

    03/16/2023, 10:22 AM
    thanks @powerful-planet-46063 for the help!
  • k

    kind-jewelry-65180

    03/16/2023, 6:49 PM
    Hey @lemon-wall-20836 , for any reason, actions dissapear from menu on show of any resource 😨 and its included in resource
    l
    • 2
    • 15
  • r

    ripe-article-50191

    03/17/2023, 1:14 PM
    Change the type of field in resource depending on user role
    l
    • 2
    • 16
  • r

    ripe-article-50191

    03/17/2023, 1:17 PM
    For example: In resource I want a select dropdown to choose the client, but in the same resource, if I am logged as client, I have 2 options, print the select disabled with the client selected, or replace the select with a hidden field with the client_id.
1...555657...64Latest