Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faker.Internet.email does not work #57

Closed
uri opened this issue Aug 12, 2016 · 9 comments
Closed

Faker.Internet.email does not work #57

uri opened this issue Aug 12, 2016 · 9 comments

Comments

@uri
Copy link

uri commented Aug 12, 2016

iex(1)> Faker.Internet.email
** (UndefinedFunctionError) function :"Elixir.Faker.Name.".first_name/0 is undefined (module :"Elixir.Faker.Name." is not available)
    :"Elixir.Faker.Name.".first_name()
    lib/faker/internet.ex:31: Faker.Internet.user_name/1
    lib/faker/internet.ex:45: Faker.Internet.email/0
@igas
Copy link
Member

igas commented Aug 13, 2016

Hi @uri, you forgot to start app check out https://github.com/igas/faker#usage TL;DR in your iex session you can run Faker.start

@denispeplin
Copy link

Not very clear from docs, it will be nice to have an example on a separate line.

@igas
Copy link
Member

igas commented Oct 9, 2016

@denispeplin @uri PR is welcome. I tried to clarify this few times, but issues like this still happen.

@igas igas closed this as completed Oct 9, 2016
@jonchoukroun
Copy link

Hi @igas I know you closed this issue, but I can't find the solution to this anywhere. How can I start the faker app in priv/repo/seeds.exs? I'm happy to write a PR with additional documentation if I figure it out.

@tobyhinloopen
Copy link
Contributor

@jonchoukroun Just a thought, but did you try adding Faker.start at the top of your seeds file?

@jonchoukroun
Copy link

@tobyhinloopen thanks for the advice, but that didn't work. I did solve it, though, by adding
import Faker
then calling it as if it had been aliased, like so:
username: Faker.Internet.username

@igas, I would be happy to make a PR for readme, maybe to add an example for using Faker in seeds.exs. Let me know if that's helpful.

Thanks for the help.

@dokicro
Copy link

dokicro commented Mar 3, 2018

@jonchoukroun I tried to da import Faker as you recommended but I get this error: module Faker is not loaded and could not be found

@uri
Copy link
Author

uri commented Mar 7, 2018

@dokicro are you running import Faker in an iex session?

@jonchoukroun
Copy link

@dokicro You have to include Faker in your dependencies. Inside mix.exs in your application's root, find the private function deps/0 which returns a list of tuples. You'll want to include Faker as one of those, then run mix deps.get at the command line.

Inside /priv/repo/seeds.exs you'll add import Faker and that lets you call it as Faker.Internet.user_name. Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants