Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for elem1, elem2, elem3 in list1, list2, list3 do
- Repo.insert{elem1, elem2, elem3}
- end
- @list_of_names ~w(Daniel Admin Goran Tomislav User1)
- @list_of_usernames ~w(daniel admin goran marex User2)
- @list_of_passwords ~w(123456 000000 123456 123456 123456)
- Repo.insert!(%User{
- name: name,
- username: username,
- password: password
- })
- defmodule <%=Rumbl%>.DatabaseSeeder do
- alias <%=Rumbl%>.Repo
- alias <%=Rumbl%>.User
- @list_of_names ~w(Daniel Admin Goran Tomislav User56)
- @list_of_usernames ~w(daniel admin goran marex user56)
- @list_of_passwords ~w(123456 000000 123456 123456 123456)
- def insert_user do
- Repo.insert!( %User{
- name: (@list_of_names |> Enum.take_random),
- username: (@list_of_usernames |> Enum.take_random),
- password: (@list_of_passwords |> Enum.take_random)
- })
- end
- end
- (1..5) |> Enum.Each(fn _ -> <%=Rumbl%>.DatabaseSeeder.insert_user end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement