无法使用Attachinary gem上传种子数据“Undefined method`photos_urls ='for object”

时间:2017-10-24 04:52:09

标签: ruby-on-rails ruby cloudinary

我正在尝试为我的Photoshoot模型上传种子数据,该模型由多个网址组成,如下所示:

RestTemplate restTemplate = new RestTemplate();
String fooResourceUrl
  = "/topicDepth";
ResponseEntity<String> response
  = restTemplate.getForEntity(fooResourceUrl + "/1", Long.class);

但是我的种子中收到以下错误消息:

NoMethodError:未定义的方法`photos_urls ='for

我的模型如下:

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
}

1 个答案:

答案 0 :(得分:0)

添加附件路径

{{1}}