user = User.new( :name => 'whatever') user.save! user = User.new( :name => 'other name') user.save!
or even better, just do:
User.create( :name => 'first user name' ) User.create( :name => 'second user name' )
... for as many users as possible.
If you want to repeat the conditions for all of them except the name, you can simply save your duplicate parameters in an instance variable and set non-duplicate attributes for each creation. Sort of:
attributes = { :gender => :male, :age => 18 } User.create( :name=> 'John', attributes } User.create( :name=> 'Fred', attributes }
source share