Faker issue with mongoid?

Skip to first unread message

Arthur Veal

Jan 22, 2015, 7:51:15 PM1/22/15
to ruby-...@googlegroups.com
I am using faker and I have used it before, but not in mongoid and I am continuously getting the error "NoMethodError: undefined method `name=' for nil:NilClass" when I try to fake users. Here is the block that is causing trouble any idea what I am doing wrong?

    # Create Tenants
        10.times do
         tenant = Tenant.new(
         tenant.name = Faker::Name.name,
         tenant.email = Faker::Internet.email,
         tenant.password = Faker::Lorem.characters(10)

Jesse Cooke

Jan 24, 2015, 7:04:29 PM1/24/15
to ruby-...@googlegroups.com
I think you might want Tenant.new(name: Faker::Name.name, ...)
You don't have tenant yet, so tenant.name will throw that NoMethodError.

You received this message because you are subscribed to the Google Groups "Ruby Faker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-faker+...@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ruby-faker.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
0 new messages