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"]
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 @customer.post %>
So that it becomes:
<% for @post in @customer.post[0..4] %>
If that doesn't work you could try this instead:
<% @customer.post[0..4].each { |post| %> ... <% } %>
Maybe: <ol> <% for post in @customer.posts.collection[0..4] do %> <li><%= post.title %></li> <% end %> </ol>