7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/cream/role.rb', line 7
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
|