better explicit check for existence of parent
This commit is contained in:
@@ -820,6 +820,10 @@ class Post < ActiveRecord::Base
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def parent_exists?
|
||||||
|
Post.exists?(parent_id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module DeletionMethods
|
module DeletionMethods
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if post.parent_id && post.parent %>
|
<% if post.parent_id && post.parent_exists? %>
|
||||||
<div class="ui-corner-all ui-state-highlight notice notice-child">
|
<div class="ui-corner-all ui-state-highlight notice notice-child">
|
||||||
<%= has_parent_message(post, @parent_post_set) %>
|
<%= has_parent_message(post, @parent_post_set) %>
|
||||||
<div id="has-parent-relationship-preview"><%= @parent_post_set.presenter.post_previews_html(self) %></div>
|
<div id="has-parent-relationship-preview"><%= @parent_post_set.presenter.post_previews_html(self) %></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user