From 9c2fed461ddd4415543063fe9c08d080b95b0d2b Mon Sep 17 00:00:00 2001 From: Craig Read Date: Fri, 24 May 2013 12:05:47 +1000 Subject: [PATCH] Removed redundant @recent_posts instance variable Not required, as we have pagination by default --- app/controllers/posts_controller.rb | 1 - app/views/posts/index.rss.haml | 2 +- spec/controllers/posts_controller_spec.rb | 1 - spec/views/posts/index.rss.haml_spec.rb | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 1ca2b5f94..6bec61061 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -5,7 +5,6 @@ class PostsController < ApplicationController def index @posts = Post.paginate(:page => params[:page]) - @recent_posts = Post.limit(100).order('created_at desc').all respond_to do |format| format.html # index.html.haml diff --git a/app/views/posts/index.rss.haml b/app/views/posts/index.rss.haml index d54ea83da..12402d0cf 100644 --- a/app/views/posts/index.rss.haml +++ b/app/views/posts/index.rss.haml @@ -3,7 +3,7 @@ %channel %title #{Growstuff::Application.config.site_name} - Recent posts from all members %link= posts_url - - @recent_posts.each do |post| + - @posts.each do |post| %item %author= post.author.login_name %title= post.subject diff --git a/spec/controllers/posts_controller_spec.rb b/spec/controllers/posts_controller_spec.rb index 5fe9c1ddd..f87f90fb9 100644 --- a/spec/controllers/posts_controller_spec.rb +++ b/spec/controllers/posts_controller_spec.rb @@ -13,7 +13,6 @@ describe PostsController do post = Post.create! valid_attributes get :index, {} assigns(:posts).should eq([post]) - assigns(:recent_posts).should eq([post]) end end diff --git a/spec/views/posts/index.rss.haml_spec.rb b/spec/views/posts/index.rss.haml_spec.rb index b839cf945..cd5f74c4d 100644 --- a/spec/views/posts/index.rss.haml_spec.rb +++ b/spec/views/posts/index.rss.haml_spec.rb @@ -4,7 +4,7 @@ describe 'posts/index.rss.haml', :type => "view" do before(:each) do controller.stub(:current_user) { nil } @author = FactoryGirl.create(:member) - assign(:recent_posts, [ + assign(:posts, [ FactoryGirl.build(:post, :id => 1, :author => @author), FactoryGirl.build(:post, :id => 2, :author => @author) ])