Help us understand the problem. What is going on with this article?

私も画像が投稿できるWebアプリを作りたい。その4(最後)

More than 1 year has passed since last update.

1.ページに画像を投稿できるボタンを作るぞ。

要約 : newとeditのhtml.erbに↓を書く

app/views/posts/new.html.erbと
app/views/posts/edit.html.erbの
「form」の中に
↓を書く。

 <%= form.label :写真をアップするぞ %>
          ①
 <%= form.file_field :image %>
             ②

①「何をするのか名前を書いてあげる」と親切
②ページを見ると、写真をアップする画面になってます。

showは詳細画面

app/views/posts/show.html.erb
<%= image_tag, @post.image.url %>
oyaken0717
https://mobile.twitter.com/oyaken0717
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away