You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class ContactReport
include Datagrid
datagrid_attribute :current_user
datagrid_attribute :sites
def initialize(current_user, attributes = {})
super(attributes)
self.current_user = current_user
if current_user
self.sites = current_user.sites.active.doing_jsa
scope do
PsmContact.index_scope.restricted(sites).includes(:user)
end
end
end
end
and now I want to add a enum filter, and its select item should be current_user.sites
filter(:site_id, :enum, :select => lambda { current_user.sites.flatten }, :prompt => "All sites") do |value|
where(:site_id => value)
end
However, I could not do that because the context for the lambda is ContactReport and it do not have a current_user methods.
Could be helpful if you can enable the select option to use current instance's method
The text was updated successfully, but these errors were encountered:
I just create a report class like this:
and now I want to add a enum filter, and its select item should be current_user.sites
However, I could not do that because the context for the lambda is ContactReport and it do not have a current_user methods.
Could be helpful if you can enable the select option to use current instance's method
The text was updated successfully, but these errors were encountered: