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

    lemon-wall-20836

    01/26/2022, 6:26 AM
    Hey @colossal-arm-85272. That’s weird. Not sure when we introduced this bug because I remember testing the team_memberships editing interface. Probably would be best if you would post a GH issue so we can track it better and have historical data. I’m away with family this week but I’ll try to post a fix ASAP. Thanks for the heads up!
  • c

    colossal-arm-85272

    01/26/2022, 3:36 PM
    Sounds good, will do—enjoy your time away!
  • i

    important-terabyte-39911

    01/26/2022, 10:55 PM
    👋 hello! I have a couple of models with a has_and_belongs_to_many relationship between them. Let's say
    Organizer
    and
    Event
    , so one event could have many organizers and one organizer can have many events, right? What I want to accomplish is to create a field in the
    Event
    resource so I can pick already existing
    Organizer
    in my database. Is that something I can do with Avo out of the box ? or do I need to create my own custom field ?
  • l

    lemon-wall-20836

    01/27/2022, 6:18 AM
    Hey
  • l

    lemon-wall-20836

    01/27/2022, 6:19 AM
    If you mean attaching an existing Organizer to an Event and vice-versa, yes. You can do that with Avo
  • l

    lemon-wall-20836

    01/27/2022, 6:19 AM
    https://github.com/avo-hq/avodemo/blob/main/app/avo/resources/project_resource.rb
  • l

    lemon-wall-20836

    01/27/2022, 6:19 AM
    Check out line 22
  • l

    lemon-wall-20836

    01/27/2022, 6:19 AM
    A project Has and belongs to many users
  • l

    lemon-wall-20836

    01/27/2022, 6:20 AM
    You can test that out here https://avodemo.herokuapp.com/avo/resources/projects/30
  • l

    lemon-wall-20836

    01/27/2022, 6:20 AM
    See how the Users panel has the Attach button where you can look up other users to attach to that Project
  • i

    important-terabyte-39911

    01/27/2022, 2:28 PM
    Thanks @User , I was doing the exact same thing, only I was expecting that I would be able to select the Organization when I was Creating the Event. Didn't actually thought about creating the Event and THEN attaching it. 🤦‍♂️
  • q

    quaint-pencil-2979

    01/28/2022, 7:05 PM
    Hello guys
  • q

    quaint-pencil-2979

    01/28/2022, 7:06 PM
    I am having a bug with actions, with the new avo version:
    Copy code
    ruby
    class ResetPassword < Avo::BaseAction
      self.name = 'Resetar senha'
    
      field :new_password, as: :text, default: '1234', name: 'Nova senha'
    
      def handle(models:, fields:)
        fail 'Senha não pode ser vazia' if fields["new_password"].blank?
    
        begin
          models.each do |model|
            model.update!(password: fields["new_password"])
          end
          succeed 'As senhas foram alteradas com sucesso.'
        rescue => e
          fail "Error ao alterar senhas: #{e.message}"
        end
      end
    end
    When i try to execute the action: ArgumentError (unknown keywords: :current_user, :resource): app/avo/actions/toggle_active.rb:6:in `handle'
  • q

    quaint-pencil-2979

    01/28/2022, 7:15 PM
    Ok, i got it, using this: def handle(**args) models, fields = args.values_at(:models, :fields)
  • q

    quaint-pencil-2979

    01/28/2022, 7:15 PM
    Maybe we need some changes at this docs: https://docs.avohq.io/1.0/actions.html#action-responses
  • q

    quaint-pencil-2979

    01/28/2022, 7:36 PM
    PR: https://github.com/avo-hq/docs/pull/28
  • l

    lemon-wall-20836

    01/31/2022, 9:24 AM
    Confirmed as a bug. Please follow this GH issue for a resolution soon. https://github.com/avo-hq/avo/issues/610
  • l

    lemon-wall-20836

    01/31/2022, 9:26 AM
    Created this discussion to see if there's need for that kind of behaviour https://github.com/avo-hq/avo/discussions/611
  • l

    lemon-wall-20836

    01/31/2022, 9:28 AM
    The issue was that we added a few more arguments to the actions handle method and forgot to update the docs in all the places. We're looking into improving that experience so you don't run into issues when we want to expose new data to methods
  • l

    lemon-wall-20836

    01/31/2022, 9:39 AM
    Created this PR. Would this fix the issue? https://github.com/avo-hq/avo/pull/612
  • i

    important-terabyte-39911

    02/02/2022, 11:32 PM
    I updated avo to the latest v1.19.0 and added
    config.raise_error_on_missing_policy = true
    but I'm not getting any exception, I already installed pundit and I only have the
    ApplicationPolicy
    so I think I should be getting exceptions on all of my resources, but that's not the case, what am I doing wrong ?
  • c

    chilly-xylophone-87449

    02/03/2022, 3:39 AM
    Whats the scoop when using friendly_id on your models? I'm throwing RecordNotFound in Avo on everything that I've added it on.
  • l

    lemon-wall-20836

    02/03/2022, 6:30 AM
    Hey @User, I've been trying to debug this issue for the past few minutes
  • l

    lemon-wall-20836

    02/03/2022, 6:30 AM
    before going forward, I want to cover my bases
  • l

    lemon-wall-20836

    02/03/2022, 6:30 AM
    have you declared the
    current_user_method
    in your initializer?
  • l

    lemon-wall-20836

    02/03/2022, 6:30 AM
    config.current_user_method = :current_user
    in
    config/initializers/avo.rb
  • l

    lemon-wall-20836

    02/03/2022, 6:31 AM
    this portion of the docs to be more precise👇 https://docs.avohq.io/1.0/authentication.html#customize-the-current-user-method
  • l

    lemon-wall-20836

    02/03/2022, 6:32 AM
    I just tested it on an app and
    raise_error_on_missing_policy
    is working if the current user method is declared
  • l

    lemon-wall-20836

    02/03/2022, 6:34 AM
    if this comes out turns out to be the case (the
    current_user_method
    is missing) we'll improve the docs to better surface the information
    i
    • 2
    • 16
  • l

    lemon-wall-20836

    02/03/2022, 6:38 AM
    Hey @User,
    friendly_id
    should be working. Have you applied a custom find scope to your resource? Here's a link to the docs with an example on
    friendly_id
    https://docs.avohq.io/1.0/customization.html#custom-find-scope if that doesn't solve it, can you shoot us up with a ticket and some sample code (resource scope & model set-up for
    friendly_id
    ) on https://avo.cool/issues ? It's easier to read the code and collaborate. Thank you!
1...232425...64Latest