Factory-bot - How to build association and nested attributes
问题 I am new to Factories and I need help for the association and nested attributes.... How do I set an admin user that creates a product? OK How do I set category to a product? Ok How do I attach images to a product? OK How do I set product's sizes (nested attibutes) user.rb has_many :products product.rb belongs_to :user belongs_to :category has_many :sizes, inverse_of: :product, dependent: :destroy #nested_attributes size.rb belongs_to :product category.rb has_many :products factories/users.rb