如何检查用户是否已提交评论?
我对编程非常陌生,谁能解释一下如何检查当前登录的用户是否已经提交了对某个场所的评论,如果有,则隐藏添加评论表单?
venue show.html.erb
<div id="reviews">
<%= render :partial => 'reviews/review', :collection => @venue.reviews %>
</div>
<%= form_for [@venue, @review] do |f| %>
<p>title: <br>
<%= f.text_field :title %></p>
<p>body: <br>
<%= f.text_field :body %></p>
<p>rating: <br>
<%= f.text_field :rating %></p>
<%= submit_tag %>
<% end %>
感谢您的帮助,非常感谢!
Im super new to programming can anyone explain how I can check whether the currently logged in user has already submitted a review for a venue and if they have, hide the add review form?
venue show.html.erb
<div id="reviews">
<%= render :partial => 'reviews/review', :collection => @venue.reviews %>
</div>
<%= form_for [@venue, @review] do |f| %>
<p>title: <br>
<%= f.text_field :title %></p>
<p>body: <br>
<%= f.text_field :body %></p>
<p>rating: <br>
<%= f.text_field :rating %></p>
<%= submit_tag %>
<% end %>
Thanks for any help its much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
类似的东西
something like