Home>

I created a comment field with rails, but it doesn't work. I don't get an error, but I can't display it well even after posting. If i have noticed, please let me know. Please.

class UgblogsController</pre>
<pre><code data-language = "show">
<p><% = notice%></p>
<% = @ user.name%>'s post 
<p>
  <strong>Title:</strong>
  <% = @ ugblog.title%>
</p>
<p>
  <strong>Subtitle:</strong>
  <% = @ ugblog.subtitle%>
</p>
<p>
  <strong>Body:</strong>
  <% = @ ugblog.Text%>
</p>
<p>
<% = image_tag @ ugblog.img.url,: size =>'330x330'%>
</p>
<% = link_to 'fix', edit_ugblog_path (@ugblog)%>|
<% = link_to 'Go to top page', ugblogs_path%>
   <% = form_for (@kome, url: {controller: 'ugblogs', action: 'show'}) do | form |%>
   <tr><th>Comments</th>
       <td><% = form.text_field: kome%></td></tr>
   <tr><th></th>
       <td><% = form.submit "Submit"%></td></tr>
    </tr>
    <% end%>
<p><% = @msg%></p>
class Ugsama
class Ugblog
  • Answer # 1

    <% = form_for (@kome, url: {controller: 'ugblogs', action: 'show'}) do | form |%>
    1) You can receive post contents by show, but the process is not written in show. I think that this is the place where you usually get with create.
    But
    That is not Ugsama, but Ugblog create. . .
    I can jump to Ugsama's create and return to the Ugblog show from there.

    Whenresources: ugsamais set in routes.rb,
    for post Since ugsama_path can be created, pass (ugblog_id: @udblog) to it.