railsで<textarea>と<submit>を使用して投稿機能を作成していたのですが、
cssを整えていたところ、突然投稿が反映されなくなりました。
ご回答よろしくお願い致します。
ルーティング
Rails.application.routes.draw
1 get 'posts/kyusyu' => "posts#kyusyu" 2 get "posts/engineering" => "posts#engineering" 3 get "posts/city" => "posts#city" 4 get "posts/education" => "posts#education" 5 get "posts/woman" => "posts#woman" 6 get "posts/prefecture" => "posts#prefecture" 7 get "posts/dental" => "posts#dental" 8 9 post "posts/kyusyucreate" => "posts#kyusyucreate" 10 post "posts/engineeringcreate" => "posts#engineeringcreate" 11 post "posts/citycreate" => "posts#citycreate" 12 post "posts/educationcreate" => "posts#educationcreate" 13 post "posts/womancreate" => "posts#womancreate" 14 post "posts/prefecturecreate" => "posts#prefecturecreate" 15 post "posts/dentalcreate" => "posts#dentalcreate" 16 17 18 get '/' => "home#top" 19 # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html 20end
コントローラー
def kyusyu @kyusyuposts=Kyusyupost.all.order(created_at: :desc) end def kyusyucreate @kyusyupost=Kyusyupost.new(content: params[:content]) @kyusyupost.save redirect_to("/posts/kyusyu") end
ビュー
<div class="uni-title"> <h1>Kyusyu Univ.<span class="japanese">九州大学</span></h1> </div> <div class="uni-post"> <%= form_tag("/posts/kyusyucreate", method: :post) do %> </div> <div class="form"> <textarea name="content">投稿内容を記入してください</textarea><br></br> <input class="submit" type="submit" value="投稿"> </div> <% end %> </div> <div class="index"> <% @kyusyuposts.each do |kyusyupost| %> <div class="index-item"> <%= kyusyupost.content %> </div> <% end %> </div>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/07/29 04:12
2020/07/29 04:38
2020/07/29 05:49