title: Simplifying this conditional statement
body: <p>I have a rather complicated (to me) statements to write in Rails. Under the <code>show.html.erb</code> of my <code>Person.rb</code> which is a user's profile. Each <code>post</code> has a <code>status</code> column in database with values <code>draft</code> or <code>published</code>.</p>
  
  <pre><code>&lt;% if @posts.blank? %&gt;
    No post.
  &lt;% else %&gt;
    &lt;% if @person == current_user %&gt;
      &lt;% @posts.each do |post| %&gt;
        Post title... (where all published and draft posts are shown)
      &lt;% end %&gt;
    &lt;% else %&gt;
      &lt;% @posts.each do |post| %&gt;
        &lt;% if post.status == "published" %&gt;
          Post title (where only published posts are shown, draft posts are hide from other users)
        &lt;% end %&gt;
      &lt;% end %&gt;
    &lt;% end %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Here's the problem. Suppose <code>User A</code> has 1 published post and 1 draft post, it works fine; but if <code>User B</code> has 2 draft posts, by right no post will be shown to other users, but I want it to show <code>No post</code> like the first 2 lines code.</p>
  
  <p>I tried <code>named_scope</code> in my <code>Post.rb</code> guided <a href="https://stackoverflow.com/questions/4921673/view-criteria-in-rails-controller">here</a>, but when I apply .published it just returned me a non-defined error.</p>
  
  <p>Please teach me how to accomplish this. Thank you very much.</p>