【发布时间】:2021-06-05 18:10:42
【问题描述】:
我有用于我的八卦的 cmets,并在我的八卦节目中展示它们。
当我点击编辑我的八卦时,它会打开新窗口并显示实际的标题和内容。
但是当我点击编辑我的评论打开视图进行编辑时,内容是空白的。当我想编辑他时如何显示实际内容。
查看 - 编辑评论:
<%= form_for edit_gossip_comment_path do |f| %>
<div class="form-group new-gossip-field">
<%= f.text_area :content, placeholder: "Content", class: 'form-control' %>
</div>
<div class="form-group margin-left-50">
<button class="btn btn-primary" type="submit">Edit Comment</button>
</div>
<% end %>
查看 - 编辑八卦:
<%= form_for @gossip do |f| %>
<div class="form-group new-gossip-field">
<%= f.text_field :title, placeholder: "Title", class: 'form-control' %>
</div>
<div class="form-group new-gossip-field">
<%= f.text_area :content, placeholder: "Content", class: 'form-control' %>
</div>
<div class="form-group margin-left-50">
<button class="btn btn-primary" type="submit">Edit Gossip</button>
</div>
<% end %>
如果我尝试让@comment 代替 edit_gossip_comment_path 不起作用,我真的不明白为什么。
如果您需要查看更多代码,请告诉我。
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-4 ruby-on-rails-5 ruby-on-rails-6