bright-tomato-27372
09/15/2022, 1:40 PMProduct.where(company_id: current_user.company_id
on their resource index page. Is using Pundit the way to do that? Going to keep looking through docs since I know it's somewhere there πlemon-wall-20836
09/15/2022, 1:49 PMtall-ghost-95744
09/18/2022, 2:39 PMcurrent_user
object inside Avo Filter objects?tall-ghost-95744
09/18/2022, 2:40 PMoptions
for a Select unique to a User's records on some table.tall-ghost-95744
09/18/2022, 2:40 PMtall-ghost-95744
09/18/2022, 2:41 PMlemon-wall-20836
09/19/2022, 8:37 AMlemon-wall-20836
09/19/2022, 8:38 AMbright-tomato-27372
09/19/2022, 12:22 PMclass Scope < Scope
def resolve
scope.where(company_id: user.company_id)
end
end
tall-ghost-95744
09/19/2022, 5:00 PMlemon-wall-20836
09/19/2022, 5:03 PMlemon-wall-20836
09/19/2022, 5:03 PMlemon-wall-20836
09/19/2022, 5:04 PMtall-ghost-95744
09/19/2022, 5:07 PMβ°β$ cat config/initializers/avo.rb
Avo.configure do |config|
config.set_context do
{
current_user: current_user,
params: request.params
}
end
tall-ghost-95744
09/19/2022, 5:08 PM12: def default
=> 13: binding.pry
14: end
[1] pry(#<ProfileUsersFilter>)> ls
ActiveSupport::ToJsonWithActiveSupportEncoder#methods: to_json
ActiveSupport::Dependencies::RequireDependency#methods: require_dependency
Filter#methods:
applied_filters applied_or_default_value apply_query component component= component? default= default? empty_message empty_message= empty_message? id name name= name? params template template= template?
Profile Users#methods: apply default options
locals: _ __ _dir_ _ex_ _file_ _in_ _out_ pry_instance
[2] pry(#<ProfileUsersFilter>)> context
NameError: undefined local variable or method `context' for #<ProfileUsersFilter:0x00007fe860fe7ea0>
from (pry):1:in `default'
[3] pry(#<ProfileUsersFilter>)>
tall-ghost-95744
09/19/2022, 5:08 PMtall-ghost-95744
09/19/2022, 5:09 PMtall-ghost-95744
09/19/2022, 5:09 PMtall-ghost-95744
09/19/2022, 5:09 PMlemon-wall-20836
09/19/2022, 5:09 PMtall-ghost-95744
09/19/2022, 5:10 PMtall-ghost-95744
09/19/2022, 5:10 PMtall-ghost-95744
09/19/2022, 5:10 PMlemon-wall-20836
09/19/2022, 5:10 PMtall-ghost-95744
09/19/2022, 5:12 PM::Avo::App.context
object.
There it was, sitting right under the instructions I had no issues following right up until that point. Ha!lemon-wall-20836
09/19/2022, 5:12 PMtall-ghost-95744
09/19/2022, 5:12 PMlemon-wall-20836
09/19/2022, 5:13 PMtall-ghost-95744
09/19/2022, 5:13 PMcontext
outright works in some places, and not in others. Working as intended π πlemon-wall-20836
09/19/2022, 5:14 PMtall-ghost-95744
09/19/2022, 5:16 PM