Sha256: 696c9554e361bf4e6ff8277c1c7862a340f5d8de3267df1cc048b81d77c2dece

Contents?: true

Size: 601 Bytes

Versions: 7

Compression:

Stored size: 601 Bytes

Contents

def default_user_setup
  @guest_user = User.create(:name => 'Guest user')  
  @guest_user.add_roles :guest
  # @guest_user.roles = :guest
  @guest_user.save     
  
  puts "Guest roles: #{@guest_user.roles_list}"
  
  @normal_user = User.create(:name => 'Normal user')
  @normal_user.roles = :guest, :user
  @normal_user.save  
  
  puts "Normal roles: #{@normal_user.roles_list}, #{@normal_user.inspect}"
  
  @admin_user = User.create(:name => 'Admin user')
  @admin_user.roles = :admin            
  @admin_user.save
  
  puts "Admin roles: #{@admin_user.roles_list}, #{@admin_user.inspect}"  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
roles_active_record-0.4.0 spec/roles_active_record/strategy/user_setup.rb
roles_active_record-0.3.6 spec/roles_active_record/strategy/user_setup.rb
roles_active_record-0.3.5 spec/roles_active_record/strategy/user_setup.rb
roles_active_record-0.3.4 spec/roles_active_record/strategy/user_setup.rb
roles_active_record-0.3.3 spec/roles_active_record/strategy/user_setup.rb
roles_active_record-0.3.2 spec/roles_active_record/strategy/user_setup.rb
roles_active_record-0.3.1 spec/roles_active_record/strategy/user_setup.rb