Class: ActiveAdmin::Permission
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ActiveAdmin::Permission
- Defined in:
- app/models/active_admin/permission.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.clear_cache ⇒ Object
43 44 45 |
# File 'app/models/active_admin/permission.rb', line 43 def clear_cache @indexed_cache = nil end |
.indexed_cache ⇒ Object
39 40 41 |
# File 'app/models/active_admin/permission.rb', line 39 def indexed_cache @indexed_cache ||= eager_load(:managed_resource).all.group_by(&:role) end |
.update_all_from_managed_resources ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/models/active_admin/permission.rb', line 29 def update_all_from_managed_resources ::ActiveAdmin::ManagedResource.all.find_each do |managed_resource| manageable_roles.values.each do |value_of_role| find_or_create_by!(managed_resource_id: managed_resource.id, role: value_of_role) do || .state = default_state end end end end |
Instance Method Details
#to_condition ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/models/active_admin/permission.rb', line 19 def to_condition [].tap do |cond| cond << state cond << action.to_sym cond << const cond << { name: name } if for_active_admin_page? end end |