Module: Cream::Role

Defined in:
lib/cream/role.rb

Class Method Summary collapse

Class Method Details

.availableObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cream/role.rb', line 17

def self.available
  return Cream.available_roles if Cream.available_roles.present?
  return Cream.roles if Cream.roles.present?

  puts "Cream didn't have available roles configured, now trying alternatives: User and Role"

  return try_role if try_role
  return try_user if try_user
        
  raise %q{Available roles could not be determined. Please do either of the following:\n
1) Create a Cream.setup block
2) Set Cream.available_roles explicitly
3) Create Role instances and ensure a call to Role.all returns them
4) Set User.roles explicitly
}          
end