Truncate array?

Sure. Do something like this:

irb(main):002:0> a = %w{ one two three four five size seven }
=> ["one", "two", "three", "four", "five", "size", "seven"]
irb(main):003:0> a[0..4]
=> ["one", "two", "three", "four", "five"]

I believe that you can simply insert the selection in this line:

        <% for @post in %>

So that it becomes:

        <% for @post in[0..4] %>

If that doesn't work you could try this instead:

        <%[0..4].each { |post| %>
        <% } %>

<% for post in @customer.posts.collection[0..4] do %>
<li><%= post.title %></li>
<% end %>