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

    straight-pager-31449

    02/17/2023, 2:45 PM
    I can prevent it from being destroyed, but the button is still visible.🤔 > destroy? to false will prevent the user from destroying a resource and hiding the delete button. https://v1-docs.avohq.io/1.0/authorization.html#policies
    l
    • 2
    • 8
  • l

    lemon-spoon-80671

    02/17/2023, 3:50 PM
    hello everyone I have an Avo resource for which I would like to add an image field, which I get from an external URL. In the docs I found this https://docs.avohq.io/2.0/fields/external_image.html which works well to access resources without authentification. In my case however, I need to send an authorization token in the header of the HTTP Get request in order to be able to access the image. I have been looking at https://docs.avohq.io/2.0/fields/file.html to find an alternative solution but am completely blocked. Has anyone faced a similar issue or has an idea of how to go about it? Thank you very much in advance for your help
    l
    • 2
    • 27
  • r

    ripe-article-50191

    02/22/2023, 8:30 AM
    Nested model:
  • r

    ripe-article-50191

    02/22/2023, 8:33 AM
    I have create a simple nested model following the tutorial https://docs.avohq.io/2.0/recipes/nested-records-when-creating.html but I have gotten
    undefined method "new" for nil:NilClass
    field = field_klass.new id, form: form, view: view, **args, &block
    in partial view with the nested fields
    <%= avo_edit_field :answer, as: :string, form: f, help: "Write the answer", required: true %>
    Any help or idea?
    l
    • 2
    • 43
  • s

    straight-pager-31449

    02/22/2023, 2:23 PM
    @lemon-wall-20836 I have a question about the license. Do I need more than one professional license for avo? I plan to run avo serverless so that it can scale with heroku and rende.com Instances will be scaled as load increases.
    l
    • 2
    • 18
  • c

    curved-father-82134

    02/22/2023, 2:23 PM
    @lemon-wall-20836 I'm having issue while using this
    field :user_id, as: :select, options: User.all.pluck(:first_name, :id), name: I18n.t('avo.order.select_customer')
    ` It's working fine while using website. All the Linter and Test cases are fine. but on Github showing me this. When i remove this field or use it like this way
    field :user_id, as: :select, options: {'Tracy': '1',
    It's work as expected. Can you pleas guide me where I'm wrong. Thanks in advance.
    l
    • 2
    • 20
  • p

    powerful-planet-46063

    02/23/2023, 12:20 AM
    Has anyone implemented using
    Current
    successfully? For me the user is reached by parts of Avo (logged in and displayed in the menu) but is not being passed into the Pundit policy. I have come up with a work around which I can gladly share but given that the following is in the docs I'm wondering If Im missing something.
    Copy code
    ruby
    Avo.configure do |config|
      config.current_user_method do
        Current.user
      end
    end
  • s

    strong-restaurant-36788

    02/23/2023, 2:35 AM
    I just ran into this yesterday. I ended up writing current_user || Current.user to get past it. But didn’t dig any further. That code isn’t in prod yet for us. So I’m not sure the implications or why.
  • s

    strong-restaurant-36788

    02/23/2023, 2:37 AM
    I should add that we ran into it only in Pundit as Current has worked for us for a long time for user name and avatar.
  • p

    powerful-planet-46063

    02/23/2023, 2:41 AM
    Thanks for the sanity check. Pundit is where the issue appears for me as well. I am not using devise but ultimately end up doing something similar.
    Current.user || Session.find_by_id(cookies.signed[:session_token])&.user
    Where
    Current.user
    is essentially set the same way anyway so it's mostly a matter of redundancy here.
  • s

    strong-restaurant-36788

    02/23/2023, 3:23 AM
    I’m using clearance for authentication. I’m wondering if current_user_method is getting called later than we’d expect? I didn’t try any logging to see the order but that could be it.
  • l

    lemon-wall-20836

    02/23/2023, 8:32 AM
    Current
    and
    current_user
    thread
    p
    • 2
    • 66
  • b

    boundless-artist-39401

    02/23/2023, 10:17 AM
    Hi Everyone, I am looking more and more at avo and I must say it looks quite amazing. I have a few questions today. 1) I can see that avo can deal with json fields : https://docs.avohq.io/2.0/recipes/format-ruby-object-to-json.html. Is there an easy way to perform front end validations on the json object and display warning message to the user before it is actually sent to the server ? 2) I can also see that avo can deal with field visibility based on context by passing a proc (https://docs.avohq.io/2.0/field-options.html#field-visibility). This is great ! (better than administrate). But is there a generic way to show/hide some fields based on the values being selected /checked by the current user while he is filling the form (something like a generic stimulus controller behind the scenes I guess). Thank you !
    l
    • 2
    • 10
  • n

    narrow-laptop-54609

    02/23/2023, 4:04 PM
    Running into a issue where sorting works just fine on dev but on production it just redirects to index page after trying to sort an item, anyone ran into this issue before?
  • n

    narrow-laptop-54609

    02/23/2023, 4:31 PM
    Running in production mode doesn't replicate what's going on in the real production env. could it be a compile issue?
    l
    • 2
    • 66
  • n

    narrow-laptop-54609

    02/23/2023, 4:32 PM
    Running production mode in my local env
  • n

    nice-ambulance-76519

    02/23/2023, 5:15 PM
    Hi everyone, I've just started with Avo and I'm testing with a big model which has more than 10 columns. Is there a way to show/hide fields from the table in the Index view?
  • n

    narrow-laptop-54609

    02/23/2023, 5:19 PM
    Yes, https://docs.avohq.io/2.0/field-options.html you can use
    hide_on
  • n

    nice-ambulance-76519

    02/23/2023, 5:19 PM
    Thanks 👍
  • s

    straight-pager-31449

    02/26/2023, 4:50 AM
    @lemon-wall-20836 I have a question when using multiple filters. Can I combine multiple filter buttons into one?
    l
    • 2
    • 9
  • w

    wooden-island-51391

    02/26/2023, 7:52 AM
    Posting this here in case anyone else ends up with the same issue. If you run a bundle update and suddenly your ransack searches in Avo no longer work, it's because ransack did a breaking change to their security. They moved from a everything allowed by default to everything blocked by default when it comes to attributes and associations you are allowed to ransack search by. You will need follow these docs in order to set up the approved attributes and associations on your model: https://activerecord-hackery.github.io/ransack/going-further/other-notes/#authorization-allowlistingdenylisting Sadly the config option to turn it back to everything allowed by default doesn't seem to work.
    l
    • 2
    • 2
  • s

    straight-pager-31449

    02/26/2023, 11:08 AM
    Thanks for letting us know.
  • l

    lemon-wall-20836

    02/26/2023, 1:44 PM
    yes. thanks for letting us know
  • l

    lemon-wall-20836

    02/26/2023, 1:44 PM
    I knew they were supposed to push an update for that
  • p

    powerful-planet-46063

    02/26/2023, 7:27 PM
    I have a nested resource field that I want the user to either select from a collection or create on the fly. In my current application if the user selects to create a new resource a modal is opened and upon success the result is appended as an option into all select fields on the page of the same type, as well as selected on the initial field which made the request. I have attached a video below of what that flow looks like. I'm thinking maybe the dynamic fields, and nested resources coming in 3.0 will make this possible in Avo but in the meantime before re implementing my (somewhat hacky) solution I'm wondering if anyone has solved a similar need with Avo before and if so what approach was taken.
    screen-recording-2023-02-26-at-2-13-19-pm
    l
    s
    • 3
    • 23
  • q

    quiet-winter-98496

    02/27/2023, 12:42 PM
    Has anyone else found that if fields are on a tab they don't appear on the table index view? (I have a large resource with all attributes grouped into tabs, but when I go to the index view and view as a table, there are no attributes at all, which looks like this) The grid view looks fine because I've explicitly defined how the grid should look
    l
    • 2
    • 11
  • m

    mammoth-guitar-49791

    02/27/2023, 2:30 PM
    Is there a way to display text in the index view for a resource as multi line? or add a hover over to view the whole resource? I found the ability to truncate text, but it would be more desirable to allow the admin to see the whole field.
    l
    • 2
    • 7
  • s

    swift-businessperson-84139

    02/28/2023, 6:23 AM
    Is there a way to see avo in dark mode? I couldn't find anything on the docs.
    l
    • 2
    • 3
  • b

    boundless-artist-39401

    02/28/2023, 5:36 PM
    Hello there, I am following avo authorization guide : https://docs.avohq.io/2.0/authorization.html and it feels like avo should work out of the box with pundit. My application already has a lot of policies defined under app/policies. However Avo does not seem to take them into account (example def new? false end, and the create button will still appear for the resource). Is there something that need to be configured so Avo works with my existing policies ?
    l
    • 2
    • 6
  • s

    swift-businessperson-84139

    03/01/2023, 4:55 AM
    How do I translate an association like:
    Copy code
    has_many :employees, lambda {
        where(business_people: { relationship: BusinessPerson.relationships[:employee] })
      }, through: :business_people, source: :person, class_name: 'Person'
    To an avo field for a resource. I have tried:
    Copy code
    field :employees,
                as: :has_many,
                through: :business_people,
                use_resource: PersonResource,
                scope: -> { query.where(business_people: { relationship: BusinessPerson.relationships[:employee] }) }
    but it's not setting
    business_people.relationship
    properly.
    l
    • 2
    • 5
1...545556...64Latest