質問編集履歴

3

p 追加

2020/09/05 09:01

投稿

pecchan
pecchan

スコア592

test CHANGED
File without changes
test CHANGED
@@ -63,3 +63,21 @@
63
63
 
64
64
 
65
65
  先輩方教えて下さい。宜しくお願いします。
66
+
67
+
68
+
69
+
70
+
71
+ ```ruby
72
+
73
+ 2.6.3 :003 > p i.images
74
+
75
+ [#<ImageUploader:0x0000000005bb1de0 @model=#<Item id: 26, title: "え", description: "d", images: ["26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", "26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg"], public_uid: "d83edf2bb305", user_id: 1, category_id: 2, sub_category_id: 23, prefecture1_id: 14, prefecture2_id: nil, prefecture3_id: nil, prefecture4_id: nil, prefecture5_id: nil, paused: false, created_at: "2020-09-04 07:37:14", updated_at: "2020-09-04 07:37:14">, @mounted_as=:images, @staged=false, @file=#<CarrierWave::SanitizedFile:0x0000000005bb1778 @file="/home/ec2-user/environment/gv/public/uploads/item/images/26/26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", @original_filename=nil, @content_type=nil, @content=nil>, @filename=nil, @cache_id=nil, @identifier="26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", @versions={:thumb=>#<ImageUploader::Uploader46825060:0x0000000005bb16b0 @model=#<Item id: 26, title: "え", description: "d", images: ["26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", "26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg"], public_uid: "d83edf2bb305", user_id: 1, category_id: 2, sub_category_id: 23, prefecture1_id: 14, prefecture2_id: nil, prefecture3_id: nil, prefecture4_id: nil, prefecture5_id: nil, paused: false, created_at: "2020-09-04 07:37:14", updated_at: "2020-09-04 07:37:14">, @mounted_as=:images, @staged=false, @file=#<CarrierWave::SanitizedFile:0x0000000005bb11b0 @file="/home/ec2-user/environment/gv/public/uploads/item/images/26/thumb_26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", @original_filename=nil, @content_type=nil, @content=nil>, @filename=nil, @cache_id=nil, @identifier="26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", @versions={}, @parent_version=#<ImageUploader:0x0000000005bb1de0 ...>, @storage=#<CarrierWave::Storage::File:0x0000000005bb1598 @uploader=#<ImageUploader::Uploader46825060:0x0000000005bb16b0 ...>, @cache_called=nil>>}, @storage=#<CarrierWave::Storage::File:0x0000000005bb1c00 @uploader=#<ImageUploader:0x0000000005bb1de0 ...>, @cache_called=nil>>, #<ImageUploader:0x0000000005bb1138 @model=#<Item id: 26, title: "え", description: "d", images: ["26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", "26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg"], public_uid: "d83edf2bb305", user_id: 1, category_id: 2, sub_category_id: 23, prefecture1_id: 14, prefecture2_id: nil, prefecture3_id: nil, prefecture4_id: nil, prefecture5_id: nil, paused: false, created_at: "2020-09-04 07:37:14", updated_at: "2020-09-04 07:37:14">, @mounted_as=:images, @staged=false, @file=#<CarrierWave::SanitizedFile:0x0000000005bb0d50 @file="/home/ec2-user/environment/gv/public/uploads/item/images/26/26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg", @original_filename=nil, @content_type=nil, @content=nil>, @filename=nil, @cache_id=nil, @identifier="26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg", @versions={:thumb=>#<ImageUploader::Uploader46825060:0x0000000005bb0d00 @model=#<Item id: 26, title: "え", description: "d", images: ["26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", "26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg"], public_uid: "d83edf2bb305", user_id: 1, category_id: 2, sub_category_id: 23, prefecture1_id: 14, prefecture2_id: nil, prefecture3_id: nil, prefecture4_id: nil, prefecture5_id: nil, paused: false, created_at: "2020-09-04 07:37:14", updated_at: "2020-09-04 07:37:14">, @mounted_as=:images, @staged=false, @file=#<CarrierWave::SanitizedFile:0x0000000005bb0850 @file="/home/ec2-user/environment/gv/public/uploads/item/images/26/thumb_26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg", @original_filename=nil, @content_type=nil, @content=nil>, @filename=nil, @cache_id=nil, @identifier="26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg", @versions={}, @parent_version=#<ImageUploader:0x0000000005bb1138 ...>, @storage=#<CarrierWave::Storage::File:0x0000000005bb0c10 @uploader=#<ImageUploader::Uploader46825060:0x0000000005bb0d00 ...>, @cache_called=nil>>}, @storage=#<CarrierWave::Storage::File:0x0000000005bb1070 @uploader=#<ImageUploader:0x0000000005bb1138 ...>, @cache_called=nil>>]
76
+
77
+ => [#<ImageUploader:0x0000000005bb1de0 @model=#<Item id: 26, title: "え", description: "d", images: ["26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", "26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg"], public_uid: "d83edf2bb305", user_id: 1, category_id: 2, sub_category_id: 23, prefecture1_id: 14, prefecture2_id: nil, prefecture3_id: nil, prefecture4_id: nil, prefecture5_id: nil, paused: false, created_at: "2020-09-04 07:37:14", updated_at: "2020-09-04 07:37:14">, @mounted_as=:images, @staged=false, @file=#<CarrierWave::SanitizedFile:0x0000000005bb1778 @file="/home/ec2-user/environment/gv/public/uploads/item/images/26/26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", @original_filename=nil, @content_type=nil, @content=nil>, @filename=nil, @cache_id=nil, @identifier="26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", @versions={:thumb=>#<ImageUploader::Uploader46825060:0x0000000005bb16b0 @model=#<Item id: 26, title: "え", description: "d", images: ["26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", "26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg"], public_uid: "d83edf2bb305", user_id: 1, category_id: 2, sub_category_id: 23, prefecture1_id: 14, prefecture2_id: nil, prefecture3_id: nil, prefecture4_id: nil, prefecture5_id: nil, paused: false, created_at: "2020-09-04 07:37:14", updated_at: "2020-09-04 07:37:14">, @mounted_as=:images, @staged=false, @file=#<CarrierWave::SanitizedFile:0x0000000005bb11b0 @file="/home/ec2-user/environment/gv/public/uploads/item/images/26/thumb_26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", @original_filename=nil, @content_type=nil, @content=nil>, @filename=nil, @cache_id=nil, @identifier="26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", @versions={}, @parent_version=#<ImageUploader:0x0000000005bb1de0 ...>, @storage=#<CarrierWave::Storage::File:0x0000000005bb1598 @uploader=#<ImageUploader::Uploader46825060:0x0000000005bb16b0 ...>, @cache_called=nil>>}, @storage=#<CarrierWave::Storage::File:0x0000000005bb1c00 @uploader=#<ImageUploader:0x0000000005bb1de0 ...>, @cache_called=nil>>, #<ImageUploader:0x0000000005bb1138 @model=#<Item id: 26, title: "え", description: "d", images: ["26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", "26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg"], public_uid: "d83edf2bb305", user_id: 1, category_id: 2, sub_category_id: 23, prefecture1_id: 14, prefecture2_id: nil, prefecture3_id: nil, prefecture4_id: nil, prefecture5_id: nil, paused: false, created_at: "2020-09-04 07:37:14", updated_at: "2020-09-04 07:37:14">, @mounted_as=:images, @staged=false, @file=#<CarrierWave::SanitizedFile:0x0000000005bb0d50 @file="/home/ec2-user/environment/gv/public/uploads/item/images/26/26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg", @original_filename=nil, @content_type=nil, @content=nil>, @filename=nil, @cache_id=nil, @identifier="26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg", @versions={:thumb=>#<ImageUploader::Uploader46825060:0x0000000005bb0d00 @model=#<Item id: 26, title: "え", description: "d", images: ["26195e88-e983-42e9-95a3-8e1c866b35a6_1565.jpg", "26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg"], public_uid: "d83edf2bb305", user_id: 1, category_id: 2, sub_category_id: 23, prefecture1_id: 14, prefecture2_id: nil, prefecture3_id: nil, prefecture4_id: nil, prefecture5_id: nil, paused: false, created_at: "2020-09-04 07:37:14", updated_at: "2020-09-04 07:37:14">, @mounted_as=:images, @staged=false, @file=#<CarrierWave::SanitizedFile:0x0000000005bb0850 @file="/home/ec2-user/environment/gv/public/uploads/item/images/26/thumb_26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg", @original_filename=nil, @content_type=nil, @content=nil>, @filename=nil, @cache_id=nil, @identifier="26195e88-e983-42e9-95a3-8e1c866b35a6_1568.jpg", @versions={}, @parent_version=#<ImageUploader:0x0000000005bb1138 ...>, @storage=#<CarrierWave::Storage::File:0x0000000005bb0c10 @uploader=#<ImageUploader::Uploader46825060:0x0000000005bb0d00 ...>, @cache_called=nil>>}, @storage=#<CarrierWave::Storage::File:0x0000000005bb1070 @uploader=#<ImageUploader:0x0000000005bb1138 ...>, @cache_called=nil>>]
78
+
79
+ 2.6.3 :004 >
80
+
81
+ 2.6.3 :005 >
82
+
83
+ ```

2

ああ

2020/09/05 09:01

投稿

pecchan
pecchan

スコア592

test CHANGED
File without changes
test CHANGED
@@ -58,4 +58,8 @@
58
58
 
59
59
  キーと値の形じゃ無いからでしょうか?
60
60
 
61
+ imagesカラムは、JSON型で定義してあります。
62
+
63
+
64
+
61
65
  先輩方教えて下さい。宜しくお願いします。

1

2020/09/05 08:44

投稿

pecchan
pecchan

スコア592

test CHANGED
File without changes
test CHANGED
@@ -56,4 +56,6 @@
56
56
 
57
57
  なぜエラーになるのでしょうか?
58
58
 
59
+ キーと値の形じゃ無いからでしょうか?
60
+
59
61
  先輩方教えて下さい。宜しくお願いします。