Removed redundant @recent_posts instance variable

Not required, as we have pagination by default
This commit is contained in:
Craig Read committed 2013-05-24 12:05:47 +10:00
1 parent bc03a5c488
commit 9c2fed461d
4 files changed
+2 -4

No files matched your search

-1
View File
@@ -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
+1 -1
View File
@@ -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
@@ -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
+1 -1
View File
@@ -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)
])