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
# == Conditionally Display
# Provide a method name or Proc object to conditionally render a section at run time.
#
# section "Membership Summary", :if => :memberships_enabled?
# section "Membership Summary", :if => Proc.new { current_admin_user.account.memberships.any? }
You can't get access to the dashboard controller by doing:
ActiveAdmin::Dashboards.build do
controller do
def memberships_enabled?
true
end
end
end
because Dashboard doesn't inherit from DSL like pages and resources do.
This doesn't work either:
ActiveAdmin::Dashboards.build do
def memberships_enabled?
true
end
section "Membership Summary", :if => :memberships_enabled?
end
Instead, you have to add the method to the dashboard controller directly:
class Admin::DashboardController
def memberships_enabled?
true
end
end