2017-10-24 4 views
0

내가 지금처럼 URL에 대해 여러 구성 내 화보 모델 종자 데이터를 업로드하려고 해요 :Attachinary 보석과 "개체에 대한 정의되지 않은 메서드`photos_urls을 = '"씨 데이터를 업로드 할 수 없습니다

10.times { 
    urls = [ 
    'http://lorempixel.com/400/400/', 
    'http://lorempixel.com/400/400/', 
    'http://lorempixel.com/400/400/', 
    'http://lorempixel.com/400/400/', 
    'http://lorempixel.com/400/400/', 
    'http://lorempixel.com/400/400/', 
    'http://lorempixel.com/400/400/', 
    'http://lorempixel.com/400/400/' 
    ] 
    time = Faker::Time.between(DateTime.now - 1, DateTime.now + 3) 
    photoshoot = Photoshoot.new(user_id: Faker::Number.between(1, 19), photograph_id: Faker::Number.between(1, 19), start_time: time, end_time: time + Faker::Number.between(1, 2).hours, message: Faker::TheFreshPrinceOfBelAir.quote) 
    photoshoot.save! 
    photoshoot.photo_urls = urls 
} 

그러나

NoMethodError : 내 종자에 다음과 같은 오류 메시지가 받고 있어요

0,123,516 : 정의되지 않은 메서드`photos_urls를 = '

내 모델은 다음과 같다

class Photoshoot < ApplicationRecord 
    has_attachment :photos, maximum: 20 
    belongs_to :photograph 
    belongs_to :user 
end 

답변

0

추가 첨부 파일 경로

has_attached_file :photo, 
:styles => { 
:thumb=> "", 
:small => ""}, 
:path => "uploads/:class/:attachment/:id_partition/:style/:basename.:extension", 
:url => "uploads/:class/:attachment/:id/:style/:basename.:extension"