Class: Para::Acl::Role

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/para/acl/role.rb

Instance Method Summary collapse

Instance Method Details

#role_component_for(component) ⇒ Object



10
11
12
13
14
# File 'app/models/para/acl/role.rb', line 10

def role_component_for(component)
  role_components_by_component[component.id] ||= role_components.build(
    component_id: component.id
  )
end

#role_components_by_componentObject



16
17
18
19
20
# File 'app/models/para/acl/role.rb', line 16

def role_components_by_component
  @role_components_by_component ||= role_components.each_with_object({}) do |role_component, hash|
    hash[role_component.component_id] = role_component
  end
end