1
0
Fork 0

Fix after_create bug

This commit is contained in:
Andrew Tomaka 2015-10-12 15:30:06 -04:00
parent 04d6aea297
commit eee6f9f995
2 changed files with 10 additions and 11 deletions

9
app/models/guest_user.rb Normal file
View file

@ -0,0 +1,9 @@
class GuestUser
def admin?
false
end
def moderator?
false
end
end

View file

@ -1,7 +1,7 @@
class User < ActiveRecord::Base
rolify
after_create :set_admin, if: User.count == 1
after_create :set_admin, if: Proc.new { User.count == 1 }
def self.create_with_omniauth(auth)
where(provider: auth[:provider], uid: auth[:uid]).first_or_create do |user|
@ -26,13 +26,3 @@ class User < ActiveRecord::Base
self.add_role :admin
end
end
class GuestUser
def admin?
false
end
def moderator?
false
end
end