diff --git a/app/models/blog.rb b/app/models/blog.rb
index 71e0501..7092d96 100644
--- a/app/models/blog.rb
+++ b/app/models/blog.rb
@@ -81,4 +81,8 @@ class Blog < Folder
posts.empty?
end
+ def last_posts(limit=3)
+ posts.where("type != 'RssFeed'").order(:updated_at).limit(limit)
+ end
+
end
diff --git a/app/views/search/_full_blog.html.erb b/app/views/search/_full_blog.html.erb
index e96a519..1cbdea1 100644
--- a/app/views/search/_full_blog.html.erb
+++ b/app/views/search/_full_blog.html.erb
@@ -7,12 +7,12 @@
<%= _("Last posts") %> |
- <% r = blog.children.find(:all, :order => :updated_at, :conditions => ['type != ?', 'RssFeed']).last(3) %>
- ">
- <% r.each do |a| %>
- <%= link_to a.title, a.view_url, :class => 'search-blog-sample-item '+icon_for_article(a) %>
+ <% last_posts = blog.last_posts %>
+ | ">
+ <% last_posts.each do |post| %>
+ <%= link_to post.title, post.view_url, :class => 'search-blog-sample-item '+icon_for_article(post) %>
<% end %>
- <%= _('None') if r.empty? %>
+ <%= _('None') if last_posts.empty? %>
|
--
libgit2 0.21.2