> Factory.define :person do |f| > f.first_name {"MyString"} > f.middle_name {"MyString"} > f.last_name {"MyString"} > end > > Factory.define :address do |f| > f.person_id {1} > f.address {"MyString"} > f.zip {"94587"} > f.city {"MyString"} > f.state {"MyString"} > end > > > you pass a block like this if you need reevaluation like when using a rand function or faker, it makes no sense to do it with a fixed value
f.address ' foo' is the same as f.address { 'foo' } the first and second address created will have the same value in both cases f.zip rand(1000) the first and second record created will have the same value f.zip { rand(1000) } each record will have a unique value so you should add faker and then f.city {Faker::Address.city} will give you a differente city for each record -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.