Method: LeolayGenerator#create_users_for_development

Defined in:
lib/generators/leolay/leolay_generator.rb

#create_users_for_developmentObject



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/generators/leolay/leolay_generator.rb', line 220

def create_users_for_development
  return unless options.authentication?
  file = "db/seeds.rb"
  append_file file do
    <<-FILE.gsub(/^      /, '')
    #{auth_class}.delete_all if #{auth_class}.count == 1
    user=#{auth_class}.new :email => 'admin@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
    #{"user.roles=['admin']" if options.authorization?}
    user.save
    user=#{auth_class}.new :email => 'manager@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
    #{"user.roles=['manager']" if options.authorization?}
    user.save
    user=#{auth_class}.new :email => 'user@#{app_name}.com', :password => 'abcd1234', :password_confirmation => 'abcd1234'
    #{"user.roles=['user']" if options.authorization?}
    user.save
    FILE
  end if File.exists?(file)
end