miniature-optician-85831
01/12/2024, 11:21 AMminiature-optician-85831
01/18/2024, 7:30 AMalert-monkey-67616
01/23/2024, 1:37 AMbin/rails db:drop db:create db:migrate db:seed
because avo's routes eagerly load all resources, and then all model classes for those resourcesminiature-optician-85831
01/29/2024, 6:09 PMvictorious-kangaroo-12568
02/01/2024, 5:51 PMmodule Avo
module Actions
module Users
class Activate < Avo::BaseAction
resource
action Users::Activate
i'm having issues with eager loading
on_file_autoloaded': expected file app/avo/actions/users/activate.rb to define constant Users::Activate, but didn't
if I change on action module Users module Activate to -> class Users::Activate < Avo::BaseAction
works, but i want to use module notations.
Any suggestions here?miniature-optician-85831
02/04/2024, 2:06 AMminiature-optician-85831
02/04/2024, 2:08 AMminiature-optician-85831
02/07/2024, 3:55 PMminiature-optician-85831
02/13/2024, 5:19 PMbetter-restaurant-41251
02/19/2024, 3:20 AMClientResource
has two belongs_to
fields—`hospital` and `hospital_contact`—that are linked. That is, when a user is editing a Client
and selects a hospital
, the hospital_contact
select should only show contacts associated with that hospital.
I've gotten part of the way there using attach_scope
, like so:
ruby
field :hospital_contact,
as: :belongs_to,
attach_scope: -> { query.active.from_hospital(parent.hospital_id) },
required: false
This works when editing an existing Client
, but falls over when the hospital
is updated (but not saved) or when creating a new Client
, because it's reading the hospital_id
from the parent
rather than getting it from the previous field.
Is there a way to modify the field's attach_scope
based on the previous field's value? (I think if this were a select
and not a belongs_to
, I could do it with computed options?)freezing-cricket-25904
03/21/2024, 6:31 PMquaint-pencil-2979
03/22/2024, 11:44 AMminiature-optician-85831
03/27/2024, 9:35 PMminiature-optician-85831
04/10/2024, 6:10 AMlate-leather-46322
05/10/2024, 1:36 PMwonderful-application-19261
05/16/2024, 12:42 PMrake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - /application/log/avo.log (Errno::ENOENT)
Thank you advancevictorious-kangaroo-12568
05/21/2024, 7:26 PMvictorious-kangaroo-12568
05/22/2024, 9:04 PMStarted GET "/admin/resources/users" for ::1 at 2024-05-22 18:13:53 -0300
User Load (1.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", "38b63179-b9a4-4a2d-8c49-4eb0b84c78f6"], ["LIMIT", 1]]
Processing by Avo::UsersController#index as HTML
User Count (0.8ms) SELECT COUNT(*) FROM "users"
User Load (1.3ms) SELECT "users".* FROM "users" ORDER BY users.created_at desc LIMIT $1 OFFSET $2 [["LIMIT", 72], ["OFFSET", 0]]
On Avo 2.51
Started GET "/admin/resources/users" for ::1 at 2024-05-22 18:14:53 -0300
ActiveRecord::SchemaMigration Pluck (1.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
User Load (3.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."created_at" ASC, "users"."id" ASC LIMIT $2 [["id", "38b63179-b9a4-4a2d-8c49-4eb0b84c78f6"], ["LIMIT", 1]]
Processing by Avo::UsersController#index as HTML
[Avo] Performing request to avohq.io API to check license availability.
Started GET "/admin/resources/users" for ::1 at 2024-05-22 18:14:53 -0300
User Load (1.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."created_at" ASC, "users"."id" ASC LIMIT $2
faint-manchester-51052
05/27/2024, 6:13 PMlate-leather-46322
05/28/2024, 10:43 AMvictorious-kangaroo-12568
06/10/2024, 7:19 PMbetter-restaurant-41251
06/11/2024, 2:18 PMruby
Error:
PhoneNumberFieldTest#test_editing_a_phone_number_that_is_already_properly_formatted:
ActionView::Template::Error: undefined method `has_opted_for_meal_service' for nil:NilClass
app/avo/resources/client_resource.rb:292:in `block (4 levels) in <class:ClientResource>'
The line throwing the error is for a tab that is conditionally visible. We do that with this code:
ruby
tab "Meal" do
panel do
with_options visible: ->(resource:) { resource.model.has_opted_for_meal_service } do
Any ideas what might be causing resource.model
to occasionally be nil
? And/or how to shore up test setup/teardown/isolation so that it's more consistent?silly-lion-46554
07/01/2024, 8:29 AMavo-*
private gem? Is Avo 3 still friendly to open apps as Avo 2 was?
AbstractController::ActionNotFound: The action 'index' could not be found for Avo::SearchController
silly-lion-46554
07/01/2024, 6:05 PMeager-dream-725
07/19/2024, 2:36 PMalert-monkey-67616
07/25/2024, 1:21 AMminiature-optician-85831
08/06/2024, 11:30 AMmammoth-guitar-49791
10/02/2024, 8:54 AMruby
class MediumResource < Avo::BaseResource
field :utm_parameter, as: :has_one, only_on: :show
end
class Medium < ApplicationRecord
has_one :utm_parameter, dependent: :destroy
end
class UtmParameter < ApplicationRecord
belongs_to :medium
end
class UtmParameterResource < Avo::BaseResource
self.title = :id
field :utm_source, as: :text
field :utm_medium, as: :text
field :utm_campaign, as: :text
end
# frozen_string_literal: true
class MediumPolicy < ApplicationPolicy
def index?
admin?
end
def show?
true
end
def edit?
true
end
def create?
true
end
def update?
true
end
def view_utm_parameter
true
end
class Scope < Scope
def resolve
scope.all
end
end
end
ruby
undefined method `authorization' for nil:NilClass
service = resource.authorization
^^^^^^^^^^^^^^
https://cdn.discordapp.com/attachments/740893011994738751/1290960151213379584/image.png?ex=66fe5bd4&is=66fd0a54&hm=660a09b050c6d396e149b111173ae7edbe3ca62a701af7653c92a72b89df89f6&lively-knife-78496
01/03/2025, 2:07 PM# frozen_string_literal: true
module Avo
module Resources
class Base
class_attribute :anonymized_fields, default: []
end
end
end
Every time I try and override the fill record method for instance, it's simply ignored and goes straight to the regular methodstraight-lion-45603
01/14/2025, 1:04 PM