mmfkzwtty0505
@mmfkzwtty0505

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

部分テンプレートが反映されない

解決したいこと

User Info と New bookの部分テンプレートが表示されません。
エラー文も出なかったため、どのように改善すれば良いのかわからないため、どなたか教えていただきたいです。

発生している問題・エラー

部分テンプレートが表示されない。
エラー文なし。

該当するソースコード

views/books/_books.html.erb
<div class="pt-4">
  
<h1>New book</h1>
<%= form_with model: book do |f| %>

<div class="form-group">
<h4 class="py-2">Title</h4>
<%= f.text_field :title,class:"form-contorol" %>
</div>

<div class="form-group">
<h4 class="py-2">Opinion</h4>
<%= f.text_area :body, class:"form-control" %>
</div>

<%= f.submit "Create Book", class:"btn btn-success"%>

<%= end %>
</div>
views/users/usersinfo.html.erb
<h1>User info</h1>
  <table class="table">
    <tr>
      <td><%= image_tag book.user.get_profile_image(100,100) %></td>
      <td></td>
    </tr>
    <tr>
      <td>name</td>
      <td>introduction</td>
    </tr>
    <tr>
      <td><%= user.name %></td>
      <td><%= user.introduction %></td>
    </tr>
  </table>

<%= link_to edit_user_path(user.id), class:"btn btn-block btn-outline-secondary p-0 mt-3" do %>
  <i class="fas fa-user-cog"></i>
<% end %>
views/books/index.html.erb
<div class="container pt-3 pb-5">
  <div class="row">
    <div class="col-md-3 pr-1">
      <%= render "books/error_message" %>
      <%= render "users/userinfo",user:@user %>
      <%= render "books/books",book:@book %>
    </div>
    
    <div class="col-md-8 offset-md-1">
      <hi>Books</hi>
        <table class="table">
          <thead>
            <tr>
              <th></th>
              <th>Title</th>
              <th>Opinion</th>
            </tr>
          </thead>
          <% @books.each do |book| %>
            <tbody>

(省略)

自分で試したこと

<%= render "users/userinfo",user:@user %>
" " => ' 'に変換してみましたが変わりませんでした。

0

No Answers yet.

Your answer might help someone💌