@@ -37,12 +37,12 class GroupBuiltin < Group | |||
|
37 | 37 | class << self |
|
38 | 38 | def load_instance |
|
39 | 39 | return nil if self == GroupBuiltin |
|
40 | instance = order('id').first || create_instance | |
|
40 | instance = unscoped.order('id').first || create_instance | |
|
41 | 41 | end |
|
42 | 42 | |
|
43 | 43 | def create_instance |
|
44 | 44 | raise 'The builtin group already exists.' if exists? |
|
45 | instance = new | |
|
45 | instance = unscoped.new | |
|
46 | 46 | instance.lastname = name |
|
47 | 47 | instance.save :validate => false |
|
48 | 48 | raise 'Unable to create builtin group.' if instance.new_record? |
@@ -221,9 +221,9 private | |||
|
221 | 221 | end |
|
222 | 222 | |
|
223 | 223 | def self.find_or_create_system_role(builtin, name) |
|
224 | role = where(:builtin => builtin).first | |
|
224 | role = unscoped.where(:builtin => builtin).first | |
|
225 | 225 | if role.nil? |
|
226 | role = create(:name => name, :position => 0) do |r| | |
|
226 | role = unscoped.create(:name => name, :position => 0) do |r| | |
|
227 | 227 | r.builtin = builtin |
|
228 | 228 | end |
|
229 | 229 | raise "Unable to create the #{name} role." if role.new_record? |
@@ -735,9 +735,9 class User < Principal | |||
|
735 | 735 | # Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only |
|
736 | 736 | # one anonymous user per database. |
|
737 | 737 | def self.anonymous |
|
738 | anonymous_user = AnonymousUser.first | |
|
738 | anonymous_user = AnonymousUser.unscoped.first | |
|
739 | 739 | if anonymous_user.nil? |
|
740 | anonymous_user = AnonymousUser.create(:lastname => 'Anonymous', :firstname => '', :login => '', :status => 0) | |
|
740 | anonymous_user = AnonymousUser.unscoped.create(:lastname => 'Anonymous', :firstname => '', :login => '', :status => 0) | |
|
741 | 741 | raise 'Unable to create the anonymous user.' if anonymous_user.new_record? |
|
742 | 742 | end |
|
743 | 743 | anonymous_user |
General Comments 0
You need to be logged in to leave comments.
Login now