0
시드 후 space_listing_id
은 어떻게 비어 있습니까?레일즈상의 루비에 중첩 된 속성으로 시드 한 후 ID가 연관되지 않습니까?
내 모델에이 이름이 있습니다.
class SpaceListing < ActiveRecord::Base
belongs_to :user
has_many :images, dependent: :destroy
has_many :bookings, dependent: :destroy
has_many :favorites
has_many :reviews, dependent: :destroy
accepts_nested_attributes_for :images, allow_destroy: true
validates :title, presence: true
validates :description, presence: true
validates :day_rent, presence: true
validates :monthly_rent, presence: true
validates :space_type, presence: true
validates :environment_type, presence: true
validates :size_length, presence: true
validates :size_width, presence: true
validates :size_height, presence: true
end
이 내 seed.rb
이 무슨이다 :
SpaceListing.create!([
{
user_id: 1,
title: "Hipster Vest",
description: "Hipster's favorite spot",
street_number: "10",
route: "Hipster Street",
city: "San Francisco",
state: "CA",
zip_code: "94108",
country: "United States",
space_type: "Garage",
environment_type: "Outdoor",
monthly_rent: 100,
day_rent: 3,
size_width: 10,
size_height: 10,
size_length: 10,
latitude: 37.7875474,
longitude: -122.4049517,
images_attributes: [
{image_url: "https://media.giphy.com/media/26BRwxtVBt8dWEuGs/giphy.gif",
space_listing_id: },
{image_url: "https://media.giphy.com/media/l3UcgEIw80eyb36kU/giphy.gif"}
]
}
])