Issue with loading rails seed data -


i trying load seed data rails application , giving 1 error don't understand. below seed.rb file , terminal output above it. enter image description here

thanks in advance

the error don't have singular todo_list association in user model, calling create_todo_list won't work.

thus, you'll need following in db/seeds.rb:

#27 todo  = duser.todo_lists.create list_name: "list", list_due_date: date.today + 1.year #28 items = todo.todo_items.create todolistiems 

--

this assuming have following models:

#app/models/user.rb class user < activerecord::base    has_many :todo_lists    has_many :todo_list_items, through: :todo_lists end  #app/models/todo_list.rb class todolist < activerecord::base    belongs_to :user    has_many   :todo_list_items end 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -