diff --git a/README.md b/README.md index a1339bad..8b9945f1 100644 --- a/README.md +++ b/README.md @@ -77,13 +77,9 @@ bundle exec rake db:seed 7. Connect to osem.example.org and register your first user. Make also sure that Postfix is installed and configured on the system for the confirmation mail to pass through. -8. To make the first registered user an admin: -``` -rails console -User.all -me = User.find('1') -me.role_ids=[3] -``` +8. Just sign up as a new user and you will be automatically assigned as admin role. + + Caveats ======= diff --git a/app/models/user.rb b/app/models/user.rb index da74413c..d4a32cf7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -27,9 +27,13 @@ class User < ActiveRecord::Base end def setup_role + if self.id == 1 + self.role_ids = [3] + end + if self.role_ids.empty? self.role_ids = [1] - end + end end def popup_details