質問編集履歴
1
誤字
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
gem 'mini_magick','~>3.7.0'
|
|
9
9
|
|
|
10
10
|
```
|
|
11
|
-
|
|
11
|
+
book_image_uploader.rb
|
|
12
12
|
```ruby
|
|
13
|
-
class
|
|
13
|
+
class BookImageUploader < CarrierWave::Uploader::Base
|
|
14
14
|
include CarrierWave::MiniMagick
|
|
15
15
|
storage :file
|
|
16
16
|
process :resize_to_limit => [800,1200]
|
|
@@ -24,28 +24,28 @@
|
|
|
24
24
|
```
|
|
25
25
|
find.html.erb
|
|
26
26
|
```ruby
|
|
27
|
-
<div class = "
|
|
27
|
+
<div class = "bookFindImageList">
|
|
28
|
-
<%= image_tag @
|
|
28
|
+
<%= image_tag @book.book_image_url %>
|
|
29
29
|
</div>
|
|
30
30
|
```
|
|
31
|
-
|
|
31
|
+
book.rb
|
|
32
32
|
```ruby
|
|
33
|
-
class
|
|
33
|
+
class book < ActiveRecord::Base
|
|
34
|
-
mount_uploader :
|
|
34
|
+
mount_uploader :book_image, bookImageUploader
|
|
35
35
|
```
|
|
36
36
|
_form.html.erb
|
|
37
37
|
```ruby
|
|
38
38
|
|
|
39
|
-
<div class = "
|
|
39
|
+
<div class = "bookFindImageList">
|
|
40
|
-
<div class = "
|
|
40
|
+
<div class = "bookFindImagelistdemo">
|
|
41
|
-
<% if @
|
|
41
|
+
<% if @book.book_image? %>
|
|
42
42
|
<div class="thumbnail">
|
|
43
|
-
<%= image_tag @
|
|
43
|
+
<%= image_tag @book.book_image.url %>
|
|
44
44
|
</div>
|
|
45
45
|
<% end %>
|
|
46
46
|
<p>Top画像</p>
|
|
47
|
-
<%= f.file_field :
|
|
47
|
+
<%= f.file_field :book_image %>
|
|
48
|
-
<%= f.hidden_field :
|
|
48
|
+
<%= f.hidden_field :book_image_cache %>
|
|
49
49
|
</div>
|
|
50
50
|
</div>
|
|
51
51
|
```
|