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

    dazzling-kite-85871

    07/21/2021, 2:01 PM
    Hey Everyone! Has anyone seen issues with page reloads not happening after a save or an action? If I edit a record and click save the page just sits there. But if I go back to the resource manually the save has been completed. Looking at the console, there are 2 requests, a post to the resource endpoint that ends as 302, and then a get call. I'm assuming that there is some JS that should then load the results of the get request, but I'm having trouble tracking down whats happening. Thanks for any help!
  • r

    refined-furniture-64458

    07/21/2021, 2:01 PM
    what version of Avo are you using?
  • d

    dazzling-kite-85871

    07/21/2021, 2:02 PM
    Right now
    gem "avo", "~> 1.8"
  • d

    dazzling-kite-85871

    07/21/2021, 2:04 PM
    I'll try updating to see if it helps 🙂
  • d

    dazzling-kite-85871

    07/21/2021, 2:11 PM
    Same result on
    avo (1.11.6)
  • r

    refined-furniture-64458

    07/21/2021, 2:12 PM
    can you please log an issue on Github describing this? I'll try to reproduce and fix asap
  • r

    refined-furniture-64458

    07/21/2021, 2:13 PM
    https://github.com/avo-hq/avo/issues
  • d

    dazzling-kite-85871

    07/21/2021, 2:14 PM
    Yep, thank you!
  • d

    dazzling-kite-85871

    07/23/2021, 5:35 PM
    I found the issue when making a sample app to reproduce. Apparently I was loading the wrong rails defaults after a rails upgrade from a while ago. I guess there is a big difference between
    config.load_defaults 6.0
    and
    config.load_defaults 6.1
    Thanks for being so ready to jump on the problem!
  • a

    able-potato-47775

    07/28/2021, 7:13 PM
    is it possible to add
    name
    to fields such as
    has_many
    , e.g.
    Copy code
    field :goal_templates, as: :has_and_belongs_to_many, name: "Goal templates"
    such that it can affect the displayed name for the relationship? or, is there another way to handle this? thanks!
    l
    • 2
    • 12
  • l

    lemon-wall-20836

    07/29/2021, 9:55 AM
    has_many
    naming bug
  • c

    cool-greece-65430

    08/06/2021, 3:04 PM
    good morning. is there a quick example of how to modify resolve_find_scope for a resource without using the friendly gem?
  • l

    lemon-wall-20836

    08/07/2021, 9:02 AM
    Of course @cool-greece-65430. Check out the docs here https://docs.avohq.io/1.0/customization.html#custom-find-scope
  • l

    lemon-wall-20836

    08/07/2021, 9:03 AM
    You’ll find snippets of what to do to add the friendly gem
  • c

    cool-greece-65430

    08/07/2021, 1:17 PM
    Thanks but I asked about an example that doesn’t use a gem. I don’t want to add another dependency for something that should be doable without one
  • l

    lemon-wall-20836

    08/09/2021, 8:23 AM
    oh, got it
  • l

    lemon-wall-20836

    08/09/2021, 8:23 AM
    you'd probably still want to use that block
    resolve_find_scope
    to do that
  • l

    lemon-wall-20836

    08/09/2021, 8:24 AM
    I don't have any snippets or examples for that I'm afraid
  • b

    brief-king-35906

    08/09/2021, 11:32 AM
    raised this little issue around deleting attachments through active storage - https://github.com/avo-hq/avo/issues/487
  • b

    brief-king-35906

    08/09/2021, 11:32 AM
    would have sent a PR but wanted to check how this is intended to work in case i've got things setup incorrectly
  • c

    cool-greece-65430

    08/09/2021, 4:36 PM
    thanks. yeah I know that using that block is the thing to do, I just don't understand how I use it to define how to find the model. It should be easy in theory but the underlying machinations aren't straightforward and neither is that friendly gem. Unfortunately I'm leaning towards not using avo at all as a result.
  • b

    brief-king-35906

    08/09/2021, 4:49 PM
    hey - hope you don't mind me jumping in to try help... the
    resolve_find_scope
    helper provides the model's class directly. so if you want to make sure the find scope only includes users which have not been deleted you'd do something like:
    Copy code
    ruby
    class UserResource < Avo::BaseResource
      self.resolve_find_scope = ->(model_class:) do
          # model_class here is User so to do something like:
          # User.where(deleted_at: nil)
          model_class.where(deleted_at: nil)
      end
    end
  • b

    brief-king-35906

    08/09/2021, 4:50 PM
    it's a scope here - so what would get run would be
    User.where(deleted_at: nil).find(whatever_id)
  • b

    brief-king-35906

    08/09/2021, 4:51 PM
    avo will handle calling the
    find
    method so you don't need to add that in the
    resolve_find_scope
  • l

    lemon-wall-20836

    08/10/2021, 7:17 PM
    yes. perfect explanation here👆
  • l

    lemon-wall-20836

    08/10/2021, 7:17 PM
    model_class.where(deleted_at: nil)
    is the qeuvalent of
    User.where(deleted_at: nil)
  • a

    agreeable-action-34041

    08/11/2021, 4:04 AM
    Hello Everyone. Thanks for building Avo. I am facing a problem regarding custom field. I have generated a field like this...
    bin/rails generate avo:field custom_text
    then tried to use it for a string column...
    field :name, as: :custom_text
    But it doesn't work. The field just disappears from view. Can anyone help?
  • a

    agreeable-action-34041

    08/11/2021, 4:07 AM
    My Ruby: 2.7.2 Rails: 6.1.3.2 Opened an issue: https://github.com/avo-hq/avo/issues/495
  • l

    lemon-wall-20836

    08/11/2021, 9:00 AM
    I responded on the issue page 👆
  • a

    agreeable-action-34041

    08/11/2021, 10:02 AM
    @lemon-wall-20836 Thanks a lot. I tried restarting the server. It didn't help. I tested the feature in another dummy project and linked the PR in the issue. Please have a look when u have time. Thanks again.
1...111213...64Latest