写真のlisting_idを更新しようとしていますが、何らかの理由でIDが保存されません。3つ以上の画像IDの配列を渡してから、それぞれを繰り返し処理します。コードは次のとおりです。
 def create
    @listing.landlord = current_landlord
    if @listing.save
      params[:listing][:images].each do |image|
        Photo.find_by_id(image).listing_id = @listing.id
        @listing.save
      end
      render :show, :status => 200
    else
      render :status => 403, :json => {:errors => @listing.errors}
    end
  end
写真がリストIDを保存しないようにするためのアイデアはありますか?