Class: ActiveAdmin::Permission
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ActiveAdmin::Permission
- Defined in:
- app/models/active_admin/permission.rb
Class Method Summary collapse
- .clear_cache ⇒ Object
- .indexed_cache ⇒ Object
- .update_all_from_managed_resources(managed_resources) ⇒ Object
Instance Method Summary collapse
Class Method Details
.clear_cache ⇒ Object
48 49 50 |
# File 'app/models/active_admin/permission.rb', line 48 def clear_cache @_indexed_cache = nil end |
.indexed_cache ⇒ Object
44 45 46 |
# File 'app/models/active_admin/permission.rb', line 44 def indexed_cache @_indexed_cache ||= eager_load(:managed_resource).all.group_by(&:role) end |
.update_all_from_managed_resources(managed_resources) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'app/models/active_admin/permission.rb', line 34 def update_all_from_managed_resources(managed_resources) managed_resources.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
24 25 26 27 28 29 30 31 |
# File 'app/models/active_admin/permission.rb', line 24 def to_condition [].tap do |cond| cond << state cond << action.to_sym cond << const cond << { name: name } if for_active_admin_page? end end |